4 ms·
You don't have to enforce a conversion from int to bool if you just want a bool. In this example you don't want to increment by 'bool', you want to increment b
by jackewiehose 6y ago
You don't have to enforce a conversion from int to bool if you
just want a bool. In this example you don't want to increment by
'bool', you want to increment by 1 or 0 (which are ints). So you
use !!x to convert to bool and back to int.
The reason I'm pointing this out is that often enough I had to
work with code where this distinction was unknown to the author
and you come across code like if (!!x) which is, again, just
nonsense.