on-internet
← Community

Why is bool 8 bits long in C++?

Stack Overflow ·

In C++, why is the bool type 8 bits long (on my system)? Only one bit is enough to hold the Boolean value. I used to believe it was for performance reasons, but then on a 32 bits or 64 bits machine, where registers are 32 or 64 bits wide, what's the performance advantage? Or is it just one of these 'historical' reasons?

Comments

Sign in or sign up to comment and upvote.

No comments yet.