Path: utzoo!utgpu!watmath!clyde!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c Subject: Re: Standard Indentation etc. Summary: Always? Message-ID: <116@mole-end.UUCP> Date: 16 Dec 88 07:38:04 GMT References: <663@htsa.uucp> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 38 > Except the placing of the {} and the if-else I agree with this. The else > is *absolutely* not equally important as the if; it is only one of the > two alternatives (see my example with the switch-statement). Placing the > {} my way uses the same amount of vertical space and is more correct: > > while (1) while (1){ > { first; first; > second(); second(); > etc; etc; > } } > > How do you like this alternative, Gerald Hawkins ? It's a disaster. You can't do line manipulation, (either with a line editor (horrors) or editing by moving lines) without having to worry about your braces. My own preference is the ``brace-over-brace'' convention, but the most important thing in my mind is the consistent and *simple* arrangement of indentation. I see only two justifications for fractional-tab indents: In the switch(), it seems to help to put two spaces before each case. In a few large functions that are deeply nested, putting the last four or five indents at 4 spaces instead of a natural tab can help. The second case should be a fourth resort. The first resort is to get a clearer picture of the problem so that you can code it with fewer indents; the second is to arrange your solution in the most linear way possible (a vine rather than a bushy tree--see Kernighan & Plauger for details) using early exits where appropriate, and the third is to find a simple way to break the routine up. When those fail, go *consistently* to fractional indents for the *last few* levels ONLY. -- (This man's opinions are his own.) From mole-end Mark Terribile