signal & sigvec error return codes

Karl Heuer karl at haddock.ima.isc.com
Fri May 26 09:11:31 AEST 1989


In article <10319 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <8044 at batcomputer.tn.cornell.edu> lijewski at batcomputer.tn.cornell.edu (Mike Lijewski) writes:
>>Why not document the error return as being something [like]
>>#define SIG_ERR ((int(*)())-1)
>
>That's exactly what pANSI X3.159 requires (the macro, not the particular
>value), except you have the type wrong -- it should be ((void(*)())-1).

Actually, it's ((void (*)(int))-1), but the above is the next best
approximation if you don't have prototypes.

Interestingly, though, certain implementations that provide the "software
signal" package (gsignal/ssignal) now have a problem, because this package
really does use int-valued handlers.  (The return value is examined by the
implementation, to decide whether the condition has been properly handled.)
Unfortunately, they also attempt to use the same header file and macro names,
so there's a type clash.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list