This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wparentheses lumps too much together


> > 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.
-Rehno Lindeque


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]