I use the avr-gcc compiler to compile C++ code.
I'm perplexed by true. I assume it's a keyword. I also assume that bool is a built-in type. Am I wrong?
Objects of type bool can have two values, true and false. Right?
But it seems that bools that are true have a value of 0x0001, and true has a value of 0xffff. So "true" doesn't have a boolean value and isn't equal to a bool that is true!!!
For instance if we have this line:
bool george = true;
then the expression:
(george == true)
is always false. This doesn't make sense to me. I realize that it might be better to use:
than to use :
if(george == true)
but I would expect either to work, but the second way doesn't work.
Shouldn't the keyword true have a value that is boolean, that is shouldn't it have a value of 1, instead of 0xffff?
By the way, it seems that the size of a bool on most compilers these days is usually one, the same as the size of a char. Why the heck is the size of a bool on this machine two?