3 ms·
> basically no numbers in real world programs weren't constrained, it was often tests, toy programs The fact that C and C++ compilers generally chose to leave
by zerofan 10y ago
> basically no numbers in real world programs weren't constrained, it was often tests, toy programs
The fact that C and C++ compilers generally chose to leave int at 32 bit on 64 bit platforms, combined with the standards requiring "usual promotions" for smaller types to go to int bites me all the time. I'm very happy that Rust dodges the promotions problem altogether, and I'm sorry if I'm wrong about the array subscripting thing (does the snippet I provided panic at 1<<32 or 1<<34?).
> And not everybody is running on 64-bit hardware, so it's a broader default.
That argument could be used to justify 8 or 16 bit integers... :-)
- steveklabnik 10y ago> (does the snippet I provided panic at 1<<32 or 1<<34?). Overflow is a "program error", and in debug builds, is required to panic. In other builds, if it does not panic, it's required to two's compliment overflow. Rustc currently just overflows, but in the future, we'll see. That's true except our 16 bit support is nonexistant at the moment :)
- zerofan 10y ago> That's true except our 16 bit support is nonexistant at the moment :) If you pay attention to your usage statistics, I'll bet you drop 32 bit support before the May 2025 deadline we were discussing in the other thread.
- steveklabnik 10y agoWe'll see!