Re:“gcc will quietly break nearly half of all the packages t...
by kibwen on Saturday October 24, 2015 @08:44PM
(#10445459)
Bah, darn you for changing the RFC out from under me. :P
I don't understand the point of specifying wrapped behavior in unchecked mode rather than leaving the value unspecified. Surely we don't care about properly accommodating use cases that will panic in debug mode.
Re:“gcc will quietly break nearly half of all the packages t...
by dbaupp on Saturday October 24, 2015 @09:30PM
(#10445585)
It makes it easier to have assurances about the behaviour of the program, even in error cases, https://github.com/rust-lang/rfcs/pull/560#issuecomment-6999...
> The secret sauce is that Rust treats integer overflow specially
Debug vs. release mode is irrelevant: the panicking case is more expensive than any arithmetic, and, the RFC[0] was changed before it landed:
> The operations +, -, [multiplication], can underflow and overflow. When checking is enabled this will panic. When checking is disabled this will two's complement wrap.
The compiler still assumes that signed overflow may happen in release mode, and that the result needs to be computed as per two's complement, i.e. not unspecified.
[0]: https://github.com/rust-lang/rfcs/blob/master/text/0560-inte...