4 ms·
Rust wraps in release mode and traps in debug mode[0][1]. All large projects that I know of ship in release mode. Though I'd be interested to see a source for i
by lytigas 6y ago
Rust wraps in release mode and traps in debug mode[0][1]. All large projects that I know of ship in release mode. Though I'd be interested to see a source for it not pessimizing badly.
[0] https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=53775b20e6cee7611659aa44e63c2a4b https://play.rust-lang.org/?version=stable&mode=release&edit...
[1] https://github.com/rust-lang/rfcs/pull/560 https://github.com/rust-lang/rfcs/pull/560
- sanxiyn 6y agoIt is quite believable that trapping does not slow down Firefox. GCC is part of SPECint, and trapping is known not to slow down SPECint GCC. (It does slow down other SPECint benchmarks.)
- fluffy87 6y agoSee my reply to masklin in this thread for why this is incorrect. In release mode, the behavior of integer overflow in Rust is not UB/cannot happen, but modulo two arithmetic. These two are not the same thing.
- tom_mellior 6y agoHuh? Parent wrote: >> Rust wraps in release mode and traps in debug mode You wrote: > In release mode, the behavior of integer overflow in Rust is not UB/cannot happen, but modulo two arithmetic. The parent didn't claim or imply that overflow is UB. The parent wrote that it "wraps", which is equivalent to your "modulo two arithmetic". You are not in disagreement, so why are you disagreeing?