3 ms·
Integer overflow is undefined behaviour so an input for instance of 2147483647 and 1 makes the program invalid.
by jcelerier 8y ago
Integer overflow is undefined behaviour so an input for instance of 2147483647 and 1 makes the program invalid.
- saagarjha 8y agoSure, but the program is well-defined on inputs that do not cause it to overflow. It does not perform undefined behavior in those cases, so it's correct given those preconditions.