Re: Feature, or bug? [message #80295 is a reply to message #80231] |
Wed, 23 May 2012 12:32  |
whdaffer
Messages: 10 Registered: January 2000
|
Junior Member |
|
|
On May 21, 10:13 am, fawltylangu...@gmail.com wrote:
>> Hmmmm... Well check_math _does_ claim that it will report integer
>> overflow, in bit 1.
>
>> But I wouldn't be using check_math to check for that condition in the
>> construct I was using anyway, so it's moot that check_math apparently
>> falls down on the job, at least in this case.
>
>> Thanks for the explanation.
>
>> whd
>
>>> regards,
>>> Lajos
>
> The check_math help says: "Some hardware/operating system combinations may not report all of the math errors listed." Integer overflow is listed, but not checked and reported :-)
Why yes! So it does. And just one line after the table where it claims
to report integer overflows!
The right hand giveth, and the left taketh away, I guess ;-)
>
> Integer overflow is "undefined behaviour" in standard C, so it can not be done in a portable way. The glibc manual says:
>
> FPE_INTOVF_TRAP
>
> Integer overflow (impossible in a C program unless you enable overflow trapping in a hardware-specific fashion).
Which, means, effectively, that check_math for integer overflow is
worthless since I doubt that ITT or whatever they're called this week
is going to enable overflow trapping in a hardware-specific fashion.
Is the situation similar for the other errors?
whd
|
|
|