You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However as far as I can see it is nowhere actually specified what arithmetic is supposed to do when overflow-checks is turned off, or whether this is subject to change, hardware specifics, etc.
The text was updated successfully, but these errors were encountered:
In the case of implicitly-wrapped overflow, implementations must provide well-defined (even if still considered erroneous) results by using two’s complement overflow conventions.
But I think it would be better if the "Operator expressions" page said this.
I suspect that the sentence "Remember that signed integers are always represented using two's complement." was intended to convey this information (partly because I can't see what else it's doing there).
But I don't think that's a good way of saying it. It would be better to be more direct.
#949 is supposed to track unfinished business of this sort.
ehuss
added
the
Language Cleanup
Improvements to existing language which is correct but not clear, or missing examples, or the like.
label
Mar 20, 2025
It is documented what the semantics are of basic arithmetic when
overflow-checks
is turned on: https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow.However as far as I can see it is nowhere actually specified what arithmetic is supposed to do when
overflow-checks
is turned off, or whether this is subject to change, hardware specifics, etc.The text was updated successfully, but these errors were encountered: