The type of the result of all relational operators (<
, >
, <=
, >=
) is bool
:
The operators <
(less than), >
(greater than), <=
(less than or equal to), and >=
(greater than or equal to) all yield false
or true
. The type of the result is bool
.
An object of type bool
has the values true
or false
.Under integral promotion, a bool
can be converted to an int
where false
becomes 0
and true
becomes 1
:
A prvalue of type bool
can be converted to a prvalue of type int
, with false
becoming zero and true
becoming one.
bool
is an integral type, which the standard says are represented by use of a "pure binary numeration system". The footnote that describes this representation is fairly unclear as to how it maps to the values true
and false
, but you could assume that they are implying that the value representation for 0
would be all 0
bits:
A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, begin with 1, and are multiplied by successive integral power of 2, except perhaps for the bit with the highest position. (Adapted from the American National Dictionary for Information Processing Systems.)