C++ introduced a built-in boolean data type called bool . The presence of this new type makes it unnecessary to use an int with the values and 1 and improves type safety. The two possible values of a bool are true and false --these are reserved words. The compiler knows how to coerce a bool into an int and vice-versa.
If your compiler does not have the bool type and false and true keywords, an alternative is to produce such a type using a typedef of an enumeration representing the two possible values:
What makes this simple alternative attractive is that it prevents having to adjust the prolific amount of code that might use bool objects once your compiler supports the built-in type.
This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html