3 ms·
I used !! for decades, but since C'99, I've recommended "bool x = variable" or "(bool) variable".
by pklausler 10y ago
I used !! for decades, but since C'99, I've recommended "bool x = variable" or "(bool) variable".
- yoklov 10y agoThe reason I would prefer !! (or != 0) is that there are far too many err, non-bool bools. Even if you know for sure it's the stdbool.h bool, the next reader might not be aware -- presuming that when you do this you care about the distinction (otherwise I agree that the cast is fine).