Sure, but then you deserve what you get...
Posted May 28, 2011 20:48 UTC (Sat) by
BenHutchings (subscriber, #37955)
In reply to:
Sure, but then you deserve what you get... by foom
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.
(
Log in to post comments)