-Wparentheses lumps too much together
Doug Gregor
doug.gregor@gmail.com
Wed Dec 19 20:14:00 GMT 2007
On Dec 19, 2007 3:02 PM, <jklowden@freetds.org> wrote:
> One last point. In looking for the rationale behind this warning, I searched
> for examples of it. I didn't find any discussion on this list. What I did
> find were many examples of people rototilling perfectly fine code, "improving"
> it by adding unneeded parenthesis specifically so that it would compile
> cleanly with -Wall. I think that's a shame: a waste of effort at best.
>
> I ask you, please, to consider splitting advice about operator precedence from
> advice about mismatched if/else branches, and to exclude advice about
> making sure && is parenthesized ahead of || from -Wall. -Wall is the
> standard for "good, clean code" in many projects. This warning doesn't
> belong there.
For what it is worth, I completely agree with everything you have said
here. This warning oversteps the bounds of what -Wall should do, and
forces people to change perfectly good, clean code. Operator
precedence is an important concept that any C or C++ programmer should
know, and we're not helping anyone by pretending that programmer's
won't understand this concept.
We should certainly remove the warning from -Wall, and perhaps remove
it entirely.
- Doug
More information about the Gcc
mailing list