Denis Koroskin: > I don't think integer overflow could be considered an undefined behavior. > It's pretty much expected that uint.max + 1 == 0.
Computers are (mostly) deterministic, so in a certain sense everything they do can be expected :-) But sometimes the programmer "forgets" or doesn't take into account that a number can be int.max, so the overflow can be unexpected for him/her. The same can be said for array bounds, the expected that a write past the array end will give troubles, but having bound tests is often useful anyway, because it helps catch programming errors, etc. Bye, bearophile