In general – at least, in my experience – coding standards do not provide rules on how to parenthesise expressions. I suspect this is for two reasons.
Firstly, because although all programmers use parentheses to clarify the meaning of expressions, they may well disagree on what makes an expression clear. Clarity seems a matter of taste. While programmers in a team may agree (to differ) on whether tabs or spaces are to be used for indentation, their coding standard leaves them free to rewrite Example 4 as:
str += errors == 0 ? "succeeded" : "failed"
And secondly, if a coding standard were to rule on how to parenthesise, it would be difficult to find a middle ground. This leaves as candidate rules the two extremes:
The first quickly leads to unreadable code, and the second seems overly proscriptive.
In the absence of a hard rule, here are some guidelines which I hope are non-contentious and which may help us reach a conclusion:
*utf++ = 0x80 |
ucs >> 6 &
0x6f
*utf = ucs >> 6;
*utf &= 0x6f;
*utf |= 0x80;
++utf;
| Copyright © 2004 Thomas Guest |