If I define
bool y = true;
bool n = false;
is the bit-wise content of the 1-byte storage of y
and n
mandated by the standard? If so, which are those two contents? If not, then how is the comparison between bool
s themselves or between bool
s and other integer types handled?
Standard does not require any bit representation for
bool
, it only requires that there are two valuestrue
andfalse
- and in particular, it doesn't seem to require that there is only one representation for each value ([basic.fundamental]#10):It is required that
true
is mapped to1
andfalse
is mapped to0
when convertingbool
toint
([conv.prom]#6):