On Wed, Dec 19, 2007 at 03:02:35PM -0500, [EMAIL PROTECTED] wrote: > My specific candidate for exclusion from -Wall is this one: > > if (a && b || c && d) > > which yields (as you know) advice to parenthesize the two && pairs. > > I very much think this is unhelpful, counterproductive advice. > 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'. More important, a C programmer will encounter > many thousands such expressions in his dealings with the language. > To "help" him is merely to retard his education.
I am happy to stand as a counterexample; I am an experienced C programmer and I greatly appreciate this warning. And I loathe reading code which cavalierly assumes you remember the precedence. + and *, sure, you learn that in grade school. && and || is trickier because there are sensible arguments for both directions; it is harder to derive from first principles. If you are more bothered by any clarifying parentheses than I am, use -Wno-parentheses. -- Daniel Jacobowitz CodeSourcery