This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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).



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]