Integers
202307061605
Status: #idea
Tags: Rust
Integers
- Signed types start with an
iand unsigned types start with au isizeandusizeare architecture dependant (32-bit or 64-bit)_acts as a separator for numerical literals
let decimal: i32 = 1_000_000; // Equal to 1,000,000
let hex = 0xff;
let oct = 0o77;
let bin = 0b1111_0000;
Warning
Rust does not include integer overflow checks when compiling with the --release flag.
If over flow occurs, it performs two's complement wrapping[1]