Basically, it just warns you that you are converting some other integer type to bool , and this conversion is not completely free.
Basically it is present (at least as I see it) to warn that you mix bool with other integer types, which not only leads to a slight decrease in performance, but may also indicate some confusion in the code. Looking at the code in question:
int i = 0;
... what we mean by an incomplete conversion of some code that previously defined j as an int type. The definition of j been edited so that now it is of type bool , but we still assign it a value from int and (worse) using post-increment on it, both of which will do if j was of type int , but actually not with j with type bool .
So, the question is that we really wanted to assign j result of the comparison: bool j = (i != 0); or maybe a more complete conversion that would turn i into a bool :
bool i = false; // ... bool j = i; // no warning j = true; // cleaner way of producing the same result as the post-increment.
source share