??? 08/20/05 15:27 Read: times |
#99739 - Precedence vs. explicitness Responding to: ???'s previous message |
Russell Bull said:
In 'Code Complete' the author maintains if you need to read the 'c' manual to figure out the precedence of the operators then your code is too hard to read. Use brackets to show what you want to do explicitly. There was once a poster here and on other venues related to 8051 and embedded systems that berated those who used parentheses when they were not absolutely necessary, claiming that "precedence is your friend". You know, something like "real programmers rely on their unfailing memorization of precedence, grouping, association, etc." and that anybody that needs parentheses for this does not know the language well enough. Having read the books you refer to and many more, and having experienced the coding standards of many companies, I can say that I have never come across a book or coding standard that recommends relying on precedence over the explicitness of using parentheses for expressions and sub-expressions. |