This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wparentheses lumps too much together
- From: "Doug Gregor" <doug dot gregor at gmail dot com>
- To: jklowden at freetds dot org
- Cc: gcc at gnu dot org
- Date: Wed, 19 Dec 2007 15:11:22 -0500
- Subject: Re: -Wparentheses lumps too much together
- References: <20071219200235.GA21525@oak.schemamania.org>
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