Signed overflow in C
<i>If anything&#x27;s messed up, then that would be my doing.</i><p>I thought at first that some of the words in the piece were distorted as a joke about undefined behavior, but as I look at the source, I think something is just broken with the custom fonts.<p><i>If signed overflow were defined, then 12</i> * <i>i + 8 would have to have correct overflow behaviour for 32-bit values and so this trick couldn&#x27;t be done.</i><p>I feel like this misses the difference between &quot;undefined&quot; and &quot;implementation defined&quot;.   Despite the example given, those of us (like me) who complain about compilers removing safety checks rarely claim that signed 32-bit ints must have guaranteed behavior on overflow.  Overflowing might be easiest, if that&#x27;s what the hardware does naturally, but it doesn&#x27;t have to be defined to do this.<p>In our minds, it would be just fine for the compiler to generate an &quot;add&quot; instruction and let the registers fall where they may.  What we object to is the compiler&#x27;s reasoning that since &quot;undefined behavior can be presumed not to occur, I&#x27;ll just delete this spurious NULL check that the programmer accidentally put here&quot;.<p>Granted, there are cases where a compiler can take proper advantage of such optimizations, but it&#x27;s emphatically not the case that the only alternative to the current &quot;nasal daemon&quot; approach is disabling all loop optimizations.   Simply changing &quot;undefined&quot; to &quot;implementation defined&quot; would satisfy a majority of the objections.