I\'m designing a language, and trying to decide whether true
should be 0x01 or 0xFF. Obviously, all non-zero values will be converted to true, but I\'m trying t
The pros are none, and the cons are none, too. As long as you provide an automatic conversion from integer to boolean, it will be arbitrary, so it really doesn't matter which numbers you choose.
On the other hand, if you didn't allow this automatic conversion you'd have a pro: you wouldn't have some entirely arbitrary rule in your language. You wouldn't have (7 - 4 - 3) == false
, or 3 * 4 + 17 == "Hello"
, or "Hi mom!" == Complex(7, -2)
.