This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wparentheses lumps too much together
Wednesday 19 December 2007 22:11:22 tarihinde Doug Gregor ÅunlarÄ yazmÄÅtÄ:
> 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.
Agreed, for example it has lots of useless warnings when compiling ffmpeg.
Regards,
ismail
--
Never learn by your mistakes, if you do you may never dare to try again.