5 ms·
That's a good thing: the cliff is visible (zero is familiar) and intuitive (negative numbers are unsupported). The pitfalls of signed arithmetic are much more
by ridiculous_fish 8y ago
That's a good thing: the cliff is visible (zero is familiar) and intuitive (negative numbers are unsupported).
The pitfalls of signed arithmetic are much more insidious. Left shift a negative value? UB. Negate a negative value: maybe it's still negative. INT_MIN / -1? Crash!
Even basic arithmetic operations, e.g. the average of two integers, is unreasonably hard with signed arithmetic.
- chopin 8y ago>Even basic arithmetic operations, e.g. the average of two integers, is unreasonably hard with signed arithmetic. What do you have in mind? I understand that the addition can overflow, but that can happen with unsigned as well.