Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics?

Robert Dewar dewar@adacore.com
Sat Jul 2 16:47:00 GMT 2005


Andrew Pinski wrote:

> But the reason question is why make it an undefined behavior instead of
> an implementation defined?  This would have made it clearer instead of
> allowing the compiler not document what happens.  Or is C++
> just following C here?  In which case it might be better to ask the C
> committee why it was done this way and real definition of undefined for
> this case?

Note that implementation defined in practice is a fairly severe
constraint. That's because you don't want to have a super complicated
definition that takes a book to describe all the horrible things
that might happen, so in practice you are pushed into some simple
decision (always traps, always saturates, always wraps etc for the
case of overflow).




More information about the Gcc mailing list