Quote:
Originally Posted by Flynn
Thats because the storing variable is an int. If you had c as a bool, it's actually still only '1'.
|
The result of true + true is always 2. But when you assign the result, 2, back to a bool variable, the integer result 2 automatically gets converted to bool which is != 0 so it becomes "true". This conversion is why MSVC outputs a warning on bool c = true + true;
Quote:
Originally Posted by Flynn
Besides, 8bits are required for address referencing; that is not to say the -storage- that the address references is 8 bits (hence 32 bit and 64 bit machines). Regardless, a bool refers to a single bit; the first one. All other bits are thrown out (regardless of usage).
|
Yes. Just wanted to point out that when you type bool a; it will reserver one whole byte of memory and not one single bit
EDIT: Basically the only thing that is important here to me: I don't see a reason to use + in an all-bool context except to maybe confuse the reader. | is designed for that case and makes more sense to almost everyone.
__________________