Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Is there any reason `size_of::<(bool, bool)>()` has to be 2 instead of 1?
A bool
only has 2 possibilities: true
or false
. So a tuple of 2 bool
s only has 4 possibilities, well under 256 maximum possibilities that 8 bits can afford.
Rust also has size optimization for NonZero
and reference types.
So why doesn't bool
benefit from such optimization?
3 posts - 3 participants
🏷️ Rust_feed