This is the mail archive of the
mailing list for the GCC project.
Re: -Wparentheses lumps too much together
- From: "Rehno Lindeque" <errantkid at gmail dot com>
- To: "Ross Smith" <r-smith at ihug dot co dot nz>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 11 Jan 2008 09:34:29 +0200
- Subject: Re: -Wparentheses lumps too much together
- References: <20071219200235.GA21525@oak.schemamania.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <476C1461.firstname.lastname@example.org>
> > Yes, I know beginners get confused by and/or precedence. But
> > *every* language that I know of that has operator precedence places
> > 'and' before 'or'.
> FWIW, Bourne shell doesn't, && and || have equal precedence there.
> That's a bit off-topic though, as it's not an argument against your
> actual proposition, but rather one for `sh -Wall'. ;-)
> It's not entirely off-topic. Not all programmers are dedicated to a
> specific language. It's customary to work on several different
> languages, and keeping things like operator precedance straight in
> your head between languages is not always easy. Things like -Wall are
> a great help in making sure that you don't miss any of those
> inter-language oddities.
Just a note: Operator precedence is taught as logical AND comes before
OR in logic courses. So it is a sort of a standard mathematical
convention just like + and *. In fact, OR is even represented as a +
in some notations. However it might not be practical to assume all
programmers have a background in logic.