coding style, continuing education
Bruce Korb
bkorb@cruzio.com
Tue Jan 16 10:10:00 GMT 2001
sidster wrote:
>
> Greetings,
>
> How about this style:
> if
> (
> [[reformatted junk elided]]
> )
NO! (in my most unhumble opinion).
Logical KISS rules to live by:
1. Never, ever, more than two logical levels
2. If you do use two, then think long and hard about having
5-8 terms in the expression. More than 8?
Then consider another line of work.
3. If only one, then, perforce, the logical expressions are
all primitives (boolean variables or boolean expressions)
joined by either `&&' or `||', but not both.
4. Parenthesize everything. *EVERY*thing. The goal is
absolute clarity, not typing conservation.
5. Vertically align expressions (you did this one, good! :)
6. If some of the expressions have side effects (set values
in addition to testing them), then BREAK IT UP!
*sigh* ...
More information about the Gcc
mailing list