4 ms·
Unsigned integer overflow has defined behaviour in C, while signed overflow doesn't. Is it really better to protect people from a simple logical error by exposi
by rcfox 14y ago
Unsigned integer overflow has defined behaviour in C, while signed overflow doesn't. Is it really better to protect people from a simple logical error by exposing them to possible undefined behaviour?
With signed integers, you'll run into the same problem with comparing to n+1 at INT_MAX or n-1 at INT_MIN.
- barrkel 14y ago0 is a really common value for an integer variable in programs. INT_MAX and INT_MIN are not. It's just my experience. Don't get too wound up about it ;)