J
Jonathan Bartlett
I recently see the following code:
bool b = !!(flags & 0x200);
Any reason for the double ! ?
To force conversion to a boolean probably. flags & 0x200 will give an
integer result. "!" will convert it to a boolean, but the opposite
truth value, and the next "!" will convert it to the original value.
Not sure that it's actually needed, but that's at least probably what
they were thinking. They basically did that instead of shifting the bit
to the first position.
Jon