Pathalogical divides
Robert Dewar
dewar@gnat.com
Mon Sep 25 06:57:00 GMT 2000
>> This is because the division of the largest negative integer by
>> negative one results in an overflow.
But that is part of the *implementation* not the semantic definition
<<Err... In my copy of the C Standard, integer overflow invokes
undefined behavior, so signalling is acceptable behavior (just like
anything else :-)
>>
That is talking about operations which at the *semantic* level cause
integer overflow.
a % (-1) is defined for all values of a and does not cause integer
overflow, and furthermore in this particular case the range of possible
values allowed by the standard includes only zero.
More information about the Gcc
mailing list