https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17896

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org

--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
FWIW, I don't agree with the suggestion in the proposed patch because: 1) it is
not clear why this is suggested, 2) "joining" has no meaning in this context,
3) it does not warn for 'booleans' but only for 'boolean expressions' (more
precisely, comparisons), 4) given the suggested text, it will be puzzling why
adding parens silences the warning.

I think we should either follow Clang here or we should say something like "&
will evaluate the boolean expression to its right, did you mean '&&'?"
The C/C++ maintainers may even have different opinions.

Also, the patch not warning for expressions with side effects seems to be the
opposite of what we want:

a>0 & b>0 vs. a>0 && b>0 is harmless.

f()>0 & f()>0 vs. f()>0 && f()>0 is most probably a bug.

Reply via email to