On 10/30/2013 03:23 PM, David Brown wrote: > I believe that's only a minor reason for making signed overflows > undefined behaviour. If it were a matter of implementation, I think it > would have been made "implementation defined" rather than "undefined", > so that two's complement machines could use wrapping while other systems > (which are very rare now) could have other defined overflow behaviour. > > The main reason (again, this is my guess - I don't know what the C > standards folk /actually/ thought) is that there is no obvious "correct" > behaviour for signed overflow
A more important reason that having signed overflow undefined allows a lot of powerful loop optimization algorithms. Andrew.