3 ms·
> If the requested behaviour is unspecified (just `a+b`), overflows cause runtime panic. As far as I know most machines can't trap on signed integer overflow.
by jstimpfle 11y ago
> If the requested behaviour is unspecified (just `a+b`), overflows cause runtime panic.
As far as I know most machines can't trap on signed integer overflow. Which means having runtime panic is not practical. The page you linked says "no checking by default for optimized builds".
- viraptor 11y agoOk, I simplified this too much. For full details of what happens you'll have to read the docs. The non-release mode panics. Release mode with debug asserts turned on panics. Release mode with forced overflow checks panics. Release mode with no special options results in the same result as a wrapping operation.