signal & sigvec error return codes

Doug Gwyn gwyn at smoke.BRL.MIL
Fri May 26 02:40:40 AEST 1989


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
>along the lines of SIG_ERR, where SIG_ERR is defined as
>#define SIG_ERR ((int(*)())-1)
>in <signal.h>?

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).  Some older <signal.h>s also use the wrong types;
we got AT&T to fix theirs with SVR3, and other vendors will also need
to straighten this out for ANSI C and POSIX conformance.

Since you can't count on SIG_ERR being defined by non-ANSI <signal.h>,
what you should write is
	#include <signal.h>
	#ifndef SIG_ERR	/* assume the traditional implementation */
	#define SIG_ERR ((void(*)())-1)
	#endif



More information about the Comp.lang.c mailing list