Background
In C++, booleans are stored as integers:
Boolean values are not actually stored in Boolean variables as the words “true” or “false”. Instead, they are stored as integers: true becomes the integer 1, and false becomes the integer 0. Similarly, when Boolean values are evaluated, they don’t actually evaluate to “true” or “false”. They evaluate to the integers 0 (false) or 1 (true). Because Booleans actually store integers, they are considered an integral type.
However, this seemed to contradict something I have seen. I recently came across a branched file that seemed to imply that the float value 0.0 is also equivalent to false as shown below:
Base Version
arraySet_[m][n].resize(VALUES().maximumCellsPerRow[r], 0.0);
Branched Version
arraySet_[m][n].resize(VALUES().maximumCellsPerRow[r],false);
Given this equivalence I have seen, I am now wondering...
Question
Even though booleans are stored as integers, does C++ interpret the float
value of 0.0 as false as well?