??? 06/30/07 00:46 Read: times |
#141359 - Problem Responding to: ???'s previous message |
Andy Peters said:
use parentheses liberally I choose this one section from your post to illustrate a counter-example. If you always "use parentheses liberally" then what happens is that, over time, you begin to forget the rules of operator precedence. I don't mean on operators like + and * (the rules of which are drilled very deep into us), but rather like: if((a & 0x01) && (b & 0x80)) { ... }Do you know whether the inner parentheses are necessary? Or have you forgotten whether & or && has higher precedence? What if you come across the code: if(a & 0x01 && b & 0x80) { ... }Is this a bug, or is it ok? If you always "use parentheses liberally" then you tend to have to reach for your programming reference to look it up. If this happens only occasionally, then that's ok, but if it happens all the time (like when you're maintaining a "foreign" codebase), then you become bogged down and unproductive. So be careful how much you "dumb down" your coding, because there's a point at which it starts to "dumb" you down. |