Sure, but then you deserve what you get...
Posted May 28, 2011 20:48 UTC (Sat) by BenHutchings
In reply to: Sure, but then you deserve what you get...
Parent article: What Every C Programmer Should Know About Undefined Behavior #3/3
C compilers weren't smart enough to take advantage of the leeway given: they in fact did exhibit implementation-defined behavior, not undefined behavior, in the face of a signed overflow. They acted like the hardware acts upon signed overflow.
Which was to crash, in many cases. Signed overflow caused a processor exception, just like division by zero, because the result could not be represented.
to post comments)