
signal() always returns a callable function pointer?
Quote:
>Is it always safe to do this?
> old_handler = signal(SIGFOO, my_handler);
> old_handler(); /* <---- suspicious... */
The standard doesn't guarantee that; the reasons must be more or
less the ones that you state - prior art was that way. The return value
of the signal function is to be used only for resetting the signal status
back to its previous state.
A signal can be generated by a program only by calling the raise
function. Such signals, however, work more or less like ordinary function
calls - thus it is permissible to call the standard library functions from a
signal occurring because of a raise function call.
-----
/* Teach me to feel another's woe,
To hide the fault I see;
That mercy I to others show,
That mercy show to me - Alexander Pope */
/* Ajoy Krishnan T,
Senior S/W Engineer., Hughes Software Systems,
New Delhi - 19, India.