Do C++ signed types have modulo semantics?

Robert Dewar dewar@adacore.com
Tue Jun 28 10:08:00 GMT 2005


Mark Mitchell wrote:

> Although the standard clearly makes signed overflow undefined, I think 
> it would be better if GCC defined it to be modulo arithmetic.  The 
> degree to which that would result in inferior code seems likely to be 
> somewhat small, and the amount of user confusion we would eliminate, and 
> the number of programs that would not break with GCC, even though they 
> work with other compilers, seems likely to be high.

I find this reasonable, especially given the general attitude that
we don't care much if gcc programs are not easily portable to other
compilers, which is always the strongest argument against this kind
of language extension (defining the undefined).

I would prefer to make such a decision with data about the impact
on code quality, rather than Mark's "seem likely" guess.



More information about the Gcc mailing list