type of signal functions (was Abandon NULL for (0))

Chris Torek chris at mimsy.UUCP
Fri Oct 13 03:39:45 AEST 1989


>In article <19999 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>>	void (*signal(int, void (*)(int)))(int);

In article <740 at geovision.UUCP> pt at geovision.uucp (Paul Tomblin) writes:
>For some strange reason, our VMS C compiler has the following in signal.h:
>
>int (*signal (int sig, void (*func)(int, ...)) ) (int, ...);
>
>which seems slightly contradictory. ... Someone care to comment on why
>Dec did it this way, and if they are planning to fix it later?

Well, aside from the `int' at the front (which is of course entirely
incompatible with the `void' in the middle), the only difference is the
`, ...', which (on VMS and Unix VAXen, among others) makes no actual
difference in function-call mechanism.  What it does do, however, is
allow one to write

	void int_handler(int sig, int code, struct sigcontext *scp) {
		... SIGINT handling code ...
	}

as on 4BSD.  No doubt VMS also passes at least a `code' argument, so
that you can tell different kinds of floating-point exceptions apart.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list