[ILUG] C - catching or ignoring SIGFPE
dave.neary at palamon.ie
Tue Nov 13 11:24:44 GMT 2001
Kevin O Riordan wrote:
> Morning everybody,
> Is there any way to catch, or ignore, a SIGFPE ? This isn't for
> any practical reason, just to satisfy curiosity.
The devil's in the detail here. At the end of the manpage for sigaction,
there's a note which says
" According to POSIX, the behaviour of a process is unde
fined after it ignores a SIGFPE, SIGILL, or SIGSEGV signal
that was not generated by the kill() or the raise() func
tions. Integer division by zero has undefined result. On
some architectures it will generate a SIGFPE signal.
(Also dividing the most negative integer by -1 may gener
ate SIGFPE.) Ignoring this signal might lead to an end
And in fact, if you raise the FPE with raise() rather than with i=3/0;
then the ignore and catch stuff works fine.
Sorry there's no better answer than "You can't, in general", but there
David Neary, E-Mail dave.neary at palamon.ie
Palamon Technologies Ltd. Phone +353-1-634-5059
More information about the ILUG