This keyword is a built-in type. A variable of this type can have values
false. Conditional expressions have the type
bool and so have values of type
bool. For example,
i != 0 now has
false depending on the value of
Visual Studio 2017 version 15.3 and later (Available with /std:c++17 and later): The operand of a postfix or prefix increment or decrement operator may not be of type
bool. In other words, given a variable
b of type
bool, these expressions are no longer allowed:
b++; ++b; b--; --b;
false have the following relationship:
!false == true !true == false
In the following statement:
if (condexpr1) statement1;
statement1 is always executed; if
statement1 is never executed.
When a postfix or prefix
++ operator is applied to a variable of type
bool, the variable is set to
Visual Studio 2017 version 15.3 and later:
bool was removed from the language and is no longer supported.
The postfix or prefix
-- operator can't be applied to a variable of this type.
bool type participates in default integral promotions. An r-value of type
bool can be converted to an r-value of type
false becoming zero and
true becoming one. As a distinct type,
bool participates in overload resolution.
Submit and view feedback for