proper semi-portable use of signal()?
Guido van Rossum
guido at cwi.nl
Wed Mar 27 19:18:23 AEST 1991
In article <3223 at charon.cwi.nl> I asked:
>>... the declaration for signal() in <signal.h> looks as follows:
>> extern void (*signal(int, void (*) (int, ...)))(int, ...);
>>
>>[gcc complains about:]
>> #include <signal.h>
>> void (*sigsave)();
>> ...
>> signal(SIGINT, sigsave);
Norman Diamond replies:
>You did not declare void (*sigsave)(int, ...);
Indeed, but I believe my code conforms to the Standard: 4.7.1.1 lists
the second argument of signal() as void (*func)(int), not as void
(*func)(int, ...). I thought varargs (sorry, stdarg) functions *had*
to be declared with prototypes, while for functions with fixed
argument lists, old style declarations were also acceptable.
Therefore I believe my declaration is compatible with the standard,
while the <signal.h> in question (provided by SGI) is not. Any other
opinions?
--Guido van Rossum, CWI, Amsterdam <guido at cwi.nl>
"The life of a Repo Man is always intense"
More information about the Comp.std.c
mailing list