#define SIG_IGN (void (*)(int))1
#define SIG_HOLD (void (*)(int))5
#define SIG_ERR ((void (*)(int))-1)
I know what (void (*)(int))
means: cast unknown_name into pointer to function (int) returning void.
But what's the meaning of the following 1
?
The constant is used so that it can be distinguished from a valid function pointer. It has no meaning in itself (other than being distinct).
For example:
None of those constant values is something that you could call as a valid function address. So they are useful as special values that can be used to say how to handle signals.
POSIX by the way does not mention these constants
-1
,0
or1
, preferring to say only symbolic constants (in the expected place, anyway):<signal.h>
.Further reading: