3 ms·
> It is too late when undefined behavior has already happened. This seems more like a theoretical concern, as just about all the hardware out there is 2's com
by userbinator 12y ago
> It is too late when undefined behavior has already happened.
This seems more like a theoretical concern, as just about all the hardware out there is 2's complement and signed overflow wraps around in the usual way - because that's the simplest, most straightforward way to implement it. (This also means I think compilers that exploit this "loophole" in the language are seriously violating the principle of least surprise.) If you're working on the few exceptions to this, then integer overflow is probably going to be the least of your worries...