3 ms·
I actually find ~0 more intuitive. u32::MAX makes me think the relevant concept is "a really big number"; ~0 makes me think the relevant concept is "a bunch of
by thaumasiotes 6y ago
I actually find ~0 more intuitive. u32::MAX makes me think the relevant concept is "a really big number"; ~0 makes me think the relevant concept is "a bunch of bits that are all 1s".
- ChrisSD 6y agoFair enough. But tbh I'm not sure it really matters in this context. It's just a constant that means "ignore this parameter". Whether it's "a really big number" or "a bunch of bits that are all 1s" is incidental. Btw, you can directly express "all ones" in Rust as: 0b_1111_1111_1111_1111_1111_1111_1111_1111 Though it's somewhat less succinct. ;) EDIT: Added more ones, thanks adwn!