L
Lionel B
Greetings,
Using gcc (GCC) 3.3.3 (cygwin special) on Win2K
Does anyone know if there is a convenient mechanism to cause a C++
exception to be thrown whenever a IEEE 754 floating-point "exception"
is raised?
Currently I a check the FPU status word wherever I wish to test for FP
errors and throw a C++ exception accordingly. This is fine; but
(particularly for testing/debugging) it would be useful to be able to
trap FP errors _wherever_ they might ocurr.
The GNU libc documentation
http://www.gnu.org/software/libc/manual/html_node/FP-Exceptions.html
states that it is possible to enable traps for FP exceptions such that
an FP exception generates a SIGFPE signal. One solution then might be
to define a handler for SIGFPE that throws an exception - however, I
suspect signal handlers and C++ exceptions may not play together
nicely... In any case neither the GNU libc documentation (nor gcc
docs) suggest how to enable FP trapping.
Any hints gratefully accepted,
Using gcc (GCC) 3.3.3 (cygwin special) on Win2K
Does anyone know if there is a convenient mechanism to cause a C++
exception to be thrown whenever a IEEE 754 floating-point "exception"
is raised?
Currently I a check the FPU status word wherever I wish to test for FP
errors and throw a C++ exception accordingly. This is fine; but
(particularly for testing/debugging) it would be useful to be able to
trap FP errors _wherever_ they might ocurr.
The GNU libc documentation
http://www.gnu.org/software/libc/manual/html_node/FP-Exceptions.html
states that it is possible to enable traps for FP exceptions such that
an FP exception generates a SIGFPE signal. One solution then might be
to define a handler for SIGFPE that throws an exception - however, I
suspect signal handlers and C++ exceptions may not play together
nicely... In any case neither the GNU libc documentation (nor gcc
docs) suggest how to enable FP trapping.
Any hints gratefully accepted,