Should I use parentheses in logical statements even where not necessary?

Posted by Jeff Bridgman on Programmers See other posts from Programmers or by Jeff Bridgman
Published on 2013-06-11T14:14:32Z Indexed on 2013/06/27 16:28 UTC
Read the original article Hit count: 256

Let's say I have a boolean condition a AND b OR c AND d and I'm using a language where AND has a higher order of operation precedent than OR. I could write this line of code:

If (a AND b) OR (c AND d) Then ...

But really, that's equivalent to:

If a AND b OR c AND d Then ...

Are there any arguments in for or against including the extraneous parentheses? Does practical experience suggest that it is worth including them for readability? Or is it a sign that a developer needs to really sit down and become confident in the basics of their language?

© Programmers or respective owner

Related posts about coding-style

Related posts about operator-precedence