The best thing about boolean is that even if you are wrong, you are only wrong by a bit.

  • 2
    Or two bits if that's undefined ..
  • 5
    Actually every language I know stores booleans as a byte, because it's hard to work with anything smaller. The exception being integer "flags" assigned powers of two, then you can test for the presence of the flag using bitwise arithmetic. But I don't know any language that actually optimize booleans and store eight booleans to a byte.
  • 0
    @wmhilton what about C?
  • 1
    @veslav C doesn't even bother having a bool type. The type signature of C's `if` statement accepts an int. 0 is false, and anything else is true.
  • 0
Add Comment