2 ms·
> As far as I can tell the |= operator in C++ is the same as in C, i.e. a bitwise OR operator. This is true. > It works for booleans due to their bit pattern,
by HWR_14 5y ago
> As far as I can tell the |= operator in C++ is the same as in C, i.e. a bitwise OR operator.
This is true.
> It works for booleans due to their bit pattern, but it's not the same.
This makes less sense. A bool in c++ is just an integer value with few inputs. It is, as far as I can tell, the exact same.
> Java's |= is different for ints and boolean.
Java has bool and int as different types. There were versions of C++ compilers that just straight out had bool as a typedef of int.