Visual C++4.2
typedef int bool;
typedef int BOOL;
C++ 5.0 and later
typedef int BOOL;
1=sizeof(bool);

解决方案 »

  1.   

    BOOL在标准的C++和C程序中没有定义,不可以使用...
    BOOL是微软定义的布尔类型,用于它的Windows SDK和MFC data types 
      

  2.   

    我的感觉(经验),如果在MFC下编程,尽量用BOOL,有些时候对于bool匹配地不是很好。
    大多数情况好象是一样的。我曾经一次,一个编译错误,就是把bool改成了bool才通过的。
      

  3.   

    C++ Specific bool declarators;This keyword is an integral type. A variable of this type can have values true and false. All conditional expressions now return a value of type bool. For example, i!=0 now returns true or false depending on the value of i.The values true and false have the following relationship:!false == true
    !true == false
    In the following statement: if (expres1) statement1; 
    If expres1 is true, statement1 is always executed; if expres1 is false, statement1 is never executed.When a postfix or prefix ++ operator is applied to a variable of type bool, the variable is set to true. The postfix or prefix -- operator cannot be applied to a variable of this type.The bool type participates in integral promotions. An r-value of type bool can be converted to an r-value of type int, with false becoming zero and true becoming one.END C++ SpecificMicrosoft Specific In Visual C++4.2, the Standard C++ header files contained a typedef that equated bool with int. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. That means that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in Visual C++ 5.0 and later, the same call yields 1. This can cause memory corruption problems if you have defined structure members of type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or DLLs built with the 4.2 and 5.0 or later compilers. END Microsoft Specific