Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!purdue!decwrl!shelby!unix!hplabs!hpfcdc!rml From: rml@hpfcdc.HP.COM (Bob Lenk) Newsgroups: comp.sys.hp Subject: Re: HP-UX type declaration problem with signal(2) Message-ID: <5570228@hpfcdc.HP.COM> Date: 29 Jun 89 02:38:59 GMT References: <218@bnrunix.UUCP> Organization: HP Ft. Collins, Co. Lines: 34 > 6.2--- > extern (*signal())(); > 6.5--- > extern void (*signal())(); > > Should not 6.5 have a statement more like 6.2????? The only difference is between the declarations is whether the signal handler returns an integer or returns no value. Throughout UN*X history, signal handlers have never actually returned a value (or if they did it was discarded). However, the original C language did not support declarations of functions that did not return a value, but more recent versions support the type void for this purpose. Thus the newer declaration is technically more correct. The only change this requires in user is changing from declarations from (possibly implicit) int to void. Depending on the specifics, failures to do this may generate compiler warnings, compiler errors, or neither. Any code that compiles will run without problem (as will existing binaries). The reason that HP-UX changed the declaration of signal() in 6.5 is to conform to the SVID (System V Interface Definition) Base System Definition Addendum, published in 1986 as Volume III of Issue 2 of the SVID. The previous SVID, to which 6.2 conformed, specified the int declaration. As a previous response alludes, the (proposed) ANSI C Standard specifies the void type, and specifies signal() with this declaration. Although, 6.5 does not conform to this standard, these changes are consistent with moving toward it. This change should probably have been mentioned in the Update_info file, but was not. Bob Lenk (rml@hpfcla)