3 ms·
> subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful. Agreed. Silent wrap-around on overflow is also a really terrib
by ragnese 5y ago
> subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful.
Agreed. Silent wrap-around on overflow is also a really terrible idea.
> having the language itself throw in that circumstance can also be exactly what you don't want.
Then you have to check before you do it. Or call a special overflowing function. The default should absolutely be a crash. That wouldn't even really be anything new: what happens when you divide by zero in most languages? Index an array with an index > length? Should the array index just wrap around and give you the element at length % index?