Re:Tim Bray doesn't know operator precedence rules
by jergosh on Wednesday June 30, 2010 @07:11AM
(#1474468)
Has been advocated before, notably in the Practice of Programming:
"Parentheses specify grouping and can be used to make the intent clear even when they are not required. (...) Seasoned program- mers might omit them, because the relational operators (< <= == ! = >= >) have higher precedence than the logical operators (&& and ||). When mixing unrelated operators, though, it's a good idea to parenthesix. C and its friends present pernicious precedence problems, and it's easy to make a mistake."
Re:Tim Bray doesn't know operator precedence rules
by kragen on Wednesday June 30, 2010 @10:23AM
(#1474881)
Amusingly, I sent a note to the authors of TPOP when it came out claiming that I had found a precedence error in some of the code in the book, between && and ==.
"Parentheses specify grouping and can be used to make the intent clear even when they are not required. (...) Seasoned program- mers might omit them, because the relational operators (< <= == ! = >= >) have higher precedence than the logical operators (&& and ||). When mixing unrelated operators, though, it's a good idea to parenthesix. C and its friends present pernicious precedence problems, and it's easy to make a mistake."