Path: utzoo!attcan!ncrcan!ziebmef!ross From: ross@ziebmef.uucp (Ross Ridge) Newsgroups: comp.sys.hp Subject: Re: HP-UX type declaration problem with signal(2) Message-ID: <1989Jul7.193846.3308@ziebmef.uucp> Date: 7 Jul 89 23:38:45 GMT References: <218@bnrunix.UUCP> <5570224@hpfcdc.HP.COM> Reply-To: ross@ziebmef.UUCP (Ross Ridge) Organization: Ziebmef Public Access Unix, Toronto, Ontario Lines: 56 In article <5570224@hpfcdc.HP.COM> rer@hpfcdc.HP.COM (Rob Robason) writes: >> upon looking at and comparing the 6.2 vs: the 6.5, I find >> this difference... > >> 6.2--- >> extern (*signal())(); >> 6.5--- >> extern void (*signal())(); >> >> Should not 6.5 have a statement more like 6.2????? > >This is a result of the support of ANSI C, which redefines the return >value of signal to be a pointer to void, which is an ANSICism for a >"generic" pointer. This is not correct. ANSI C (and newer Sys V releases) defines signal as returning a pointer to a function returning void (nothing). This is not the "generic" pointer to void (void *). The old way to use signal was like this: { int (*old_handler)(); int int_handler(); old_hanlder = signal(SIGINT, int_handler); } The new way is: { void (*old_handler)(/* int */); void int_handler(/* int */); old_handler = signal(SIGINT, int_handler); } That's all that has changed. If you're worried about compability do something like: #ifdef NEW_SIGNAL typedef signal_type void #else typdef signal_type int #endif Ross Ridge -- l/ attcan!tmsoft!ziebmef!ross // [OO] [oo] -()- -()- db 6502 assembly forever! //