What is bool in C++?
问题 I ran across some very interesting code that makes me wonder about what bool is. I've always considered it to be a primitive type, like int or char or long. But today, I saw something that looked like this: void boolPtrTest() { bool thisBool = true; boolPtrHere(thisBool); printf("thisBool is %s\n", thisBool ? "true" : "false"); } void boolPtrHere(bool& theBool) { theBool = false; // uhh, dereferencing anyone? } And this code runs - no errors - and prints "thisBool is false"! To further make