c - How to get further information on SIGFPE signal? -


this the gnu c library reference manual

int sigfpe

the sigfpe signal reports fatal arithmetic error. signal covers arithmetic errors, including division 0 , overflow.

bsd systems provide sigfpe handler argument distinguishes various causes of exception. in order access argument, must define handler accept 2 arguments, means must cast one-argument function type in order establish handler.

but there no example on how access argument.

i did google work not find anything.

how can information?

as eof mentioned in comments, better way this, doesn't require formally broken casts, , bonus correctly documented, install signal handler using sigaction , sa_siginfo flag, , in si_code field of second parameter (type siginfo_t) can determine floating-point error occurred:

the following values can placed in si_code sigfpe signal:

fpe_intdiv integer divide zero.

fpe_intovf integer overflow.

fpe_fltdiv floating-point divide zero.

fpe_fltovf floating-point overflow.

fpe_fltund floating-point underflow.

fpe_fltres floating-point inexact result.

fpe_fltinv floating-point invalid operation.

fpe_fltsub subscript out of range.

source: linux sigaction(2) man page

the same list readily available on freebsd siginfo man page.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -