When writing C++ code, you are probably inclined to use data types that are closest to what you are trying to express, expecting that this allows the compiler to provide the most efficient implementation possible. So, when processing boolean values, i.e., single-bit information distinguishing between true
and false
, you will likely want to use the bool
type in C++. However, this bool
type may behave in unexpected ways, in particular if you are working with codes that have to perform well and correctly in multi-threaded codes.