enabling/disabling floating point exceptions

Hi guys, I am looking to complete cross platform implementation of enabling/disabling logic in boost::execution_monitor. It looks like there is no standard interface available. I'm using _controlfp interface now on Windows. I also found these non-standard extensions: * feenableexcep/fedisableexcept available with glib 2.2 * fesettrapenable avaialble in Dinkumware (implementation of STL?) and HP * sun has something called fex_set_handling. not sure when it's available though * header fpu_control.h. Not sure where it's available though. * MAC OS X has something called _MM_SET_EXCEPTION_MASK in xmmintrin.h It also seems that in some cases the switch is compile time only (using compilation option). Would anyone care to extend this list/comment on it's applicability and/or correctness? Another change I am considering is to split floating point exception catching from other system exceptions. It seems perfectly valid scenario to set catch_system_error to false (thus avoid catching access violations etc) but still willing to catch and process floating point exception. What do you think? Gennadiy

Exception is a rather overloaded word in software development. If you mean C++ exceptions (the only thing you can catch with a C++ catch), those can only be thrown with the throw keyword; everything else is not portable. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode On Mon, Aug 31, 2009 at 12:00 AM, Gennadiy Rozental<rogeeff@gmail.com> wrote:
Hi guys,
I am looking to complete cross platform implementation of enabling/disabling logic in boost::execution_monitor. It looks like there is no standard interface available. I'm using _controlfp interface now on Windows. I also found these non-standard extensions:
* feenableexcep/fedisableexcept available with glib 2.2 * fesettrapenable avaialble in Dinkumware (implementation of STL?) and HP * sun has something called fex_set_handling. not sure when it's available though * header fpu_control.h. Not sure where it's available though. * MAC OS X has something called _MM_SET_EXCEPTION_MASK in xmmintrin.h
It also seems that in some cases the switch is compile time only (using compilation option).
Would anyone care to extend this list/comment on it's applicability and/or correctness?
Another change I am considering is to split floating point exception catching from other system exceptions. It seems perfectly valid scenario to set catch_system_error to false (thus avoid catching access violations etc) but still willing to catch and process floating point exception. What do you think?
Gennadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Emil Dotchevski <emildotchevski <at> gmail.com> writes:
Exception is a rather overloaded word in software development. If you mean C++ exceptions (the only thing you can catch with a C++ catch), those can only be thrown with the throw keyword;
No. I do not. This is how these things usually called. floating point signals, floating point traps - these are also used.
everything else is not portable.
Definitely. I am looking to create portable interface. Maybe in future it can be standardized. Gennadiy

"Gennadiy Rozental" <rogeeff@gmail.com> wrote in message news:loom.20090831T112312-339@post.gmane.org...
everything else is not portable.
Definitely. I am looking to create portable interface. Maybe in future it can be standardized.
I really do not understand, why on UNIXs the signal() problem was kept instead of mapping this into something useful like exceptions. This really needs to be put into the standard.

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: Monday, August 31, 2009 8:00 AM To: boost@lists.boost.org Subject: [boost] enabling/disabling floating point exceptions
I am looking to complete cross platform implementation of enabling/disabling logic in boost::execution_monitor. It looks like there is no standard interface available. I'm using _controlfp interface now on Windows. I also found these non-standard extensions:
* feenableexcep/fedisableexcept available with glib 2.2 * fesettrapenable avaialble in Dinkumware (implementation of STL?) and HP * sun has something called fex_set_handling. not sure when it's available though * header fpu_control.h. Not sure where it's available though. * MAC OS X has something called _MM_SET_EXCEPTION_MASK in xmmintrin.h
Would anyone care to extend this list/comment on it's applicability and/or correctness?
What a can of worms! Making it portable would encourage use. Good luck!
Another change I am considering is to split floating point exception catching from other system exceptions. It seems perfectly valid scenario to set catch_system_error to false (thus avoid catching access violations etc) but still willing to catch and process floating point exception. What do you think?
Sounds reasonable and useful. Paul --- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow@hetp.u-net.com
participants (4)
-
Emil Dotchevski
-
Gennadiy Rozental
-
Paul A. Bristow
-
Peter Foelsche