3 ms·
Integer overflows cause panics in debug mode. And its undefined behaviour in release mode. Where do you see that in the code? I can't see (left+right)/2 anywhe
by josephg 3y ago
Integer overflows cause panics in debug mode. And its undefined behaviour in release mode.
Where do you see that in the code? I can't see (left+right)/2 anywhere in the code I linked?
- deleted 3y ago[deleted]
- marcianx 3y agoI'm pretty sure it's not undefined behavior in rust in release mode if it does overflow. It's fully specified behavior, I believe.
- cornstalks 3y ago> And its undefined behaviour in release mode. No, it uses 2’s complement and is well defined in release mode. From [1]: > When you’re compiling in release mode with the --release flag, Rust does not include checks for integer overflow that cause panics. Instead, if overflow occurs, Rust performs two’s complement wrapping. [1]: https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow https://doc.rust-lang.org/book/ch03-02-data-types.html#integ...