On Fri, Jun 03, 2005 at 11:43:32AM -0400, Andrew Pinski wrote: > Everyone's who writes C/C++ should know that overflow of signed is undefined.
In practice, however, this issue is commonly ignored, because people code in a hurry, then test the behavior of the executable code, and if on all platforms tested there are overflows, but the overflows wrap and as a result the expected thing happens, the problem will not be noticed. I'm sure there are plenty of production codes that assume signed integer overflow wraps, or at least make the weaker assumption that in a = b + c + d; where all variables are integers, if one of the intermediate terms can't be represented in an integer, we still get the correct result if the final result is representable in an integer.