We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
-
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The following code prints -2147483648 -2147483648:
-2147483648 -2147483648
fn main() { let i = 0x80000000u32 as i32; println!("{} {}", i, -i); }
Both 0 - i and i / -1 generate an overflow error but it seems the unary - gladly wraps around.
0 - i
i / -1
The text was updated successfully, but these errors were encountered:
I added this to the list of unimplemented overflow checks on #22020, but thanks for the report!
Sorry, something went wrong.
No branches or pull requests
The following code prints
-2147483648 -2147483648
:Both
0 - i
andi / -1
generate an overflow error but it seems the unary-
gladly wraps around.The text was updated successfully, but these errors were encountered: