proper semi-portable use of signal()?
Guido van Rossum
guido at cwi.nl
Tue Mar 26 23:15:24 AEST 1991
I have some code that uses signal(). Nothing spectacular, e.g.:
#include <signal.h>
...
void (*sigsave)();
sigsave = signal(SIGINT, SIG_IGN);
...
signal(SIGINT, sigsave);
The compiler that comes closest to Standard C locally (gcc) warns
about this code:
sigsave = signal(SIGINT, SIG_IGN);
warning: argument passing between incompatible pointer types
signal(SIGINT, sigsave);
warning: assignment between incompatible pointer types
I don't see what's wrong. I noticed that the declaration for signal()
in <signal.h> looks as follows:
extern void (*signal(int, void (*) (int, ...)))(int, ...);
Is the header wrong, is gcc overly worried, or is my code wrong?
--Guido van Rossum, CWI, Amsterdam <guido at cwi.nl>
"What do you *mean* it's not in the computer!" -- Madonna
More information about the Comp.std.c
mailing list