It's unfortunate that the world standardized on integer overflow not giving an error. Error on integer overflow should have been the default behavior, with programmers having to explicitly choose wrapping without overflow when that was desired.
Of course, that would also have required explicit signed and unsigned arithmetic operations, because overflow (and underflow) differ for signed vs. unsigned.
Now the no-overflow-error behavior is entrenched in C and C++.
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
🇺🇦 haxadecimal (brouhaha@mastodon.social)'s status on Thursday, 12-Jan-2023 03:52:19 JST 🇺🇦 haxadecimal