Hacker News new | ask | show | jobs
by _fbpt 2389 days ago
Doesn't Rust arithmetic wraparound on release? I read Microsoft's Midori language paniced/abandoned on overflow even in release, and the compiler got quite good at optimizing overflow checks away.
2 comments

If you wrap around you get implementation defined behavior, which can be chosen to either panic!, or wrap-around. In release, the default is wrap-around, but you can set it to panic.
The rules are slightly more complex than that to allow the behavior to change in the future, but they currently two’s compliment wrapping, yes.