Hi all, I'd like to catch automatically over/underflows on floating point and integer arithmetic. I thought -ftrapv would do the trick but I don't really understand how it works. From the latest manual online: -ftrapv This option generates traps for signed overflow on addition, subtraction, multiplication operations.
I don't understand what's _a trap_. Does it send a signal or something I can catch? My idea in C++ is to catch whatever this sends and through a custom exception. A little after in the manual I have: -fnon-call-exceptions Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime support that does not exist everywhere. Moreover, it only allows trapping instructions to throw exceptions, i.e. memory references or floating point instructions. It does not allow exceptions to be thrown from arbitrary signal handlers such as SIGALRM. Does it mean that if I use this, exceptions are thrown when I have an over/underflow? Could someone please explain me what happens inside g++? Another issue is if you think this is better than implementing a new number type (consider it well implemented) which overloads all arithmetic operators and throws exceptions when needed. Thanks in advance for your comments, Paulo Matos _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus