Standard Indentation etc.

Mark A Terribile mat at mole-end.UUCP
Fri Dec 16 18:00:07 AEST 1988


>   1. {} ARE NOISE FOR THE COMPILER ...
>      blocks give you everything that you need.
>   2. it is absurd [to think that] you need the {}'s to enforce white space... 
>   3. Editing convenience is then the determining factor ...
 ....
> As it is, you need to add brackets.  The only place for the open bracket
> is on the first line, and you have two choices for the closing bracket
> (other than Ritchie's choice) :
> 
>  while (1) {			while (1) {
>     first;			   first;
>     second();			   second();
>     etc; }/*while*/;		   etc;
> 				   }/*while*/;

Only if you assume that you can't afford to ``waste'' a line.  If you
want the most editing convenience, put the braces on lines by themselves
altogether.  Then when you go from a 4-statement body to a 1-statement
body, you can dispense with them w/out editing the ``control'' line.
 
> Note : the brackets DO NOT LINE UP, and it DOESN'T MATTER.  Brackets are
> for the compiler, and it doesn't care where they are.  Indentation
> blocks are for humans, and this bracket placement emphasizes the correct
> 2d blocks.

It matters to me because I have to get them right.  For that reason, I want
to keep them where I can see them.

> (Commenting all closing brackets is my personal style ... I recommend it.)

I *STRONGLY* disagree.  If a comment parrots the code, it's useless.  If
it parrots the code because it's hard to see what the code is doing, it can
easily get broken when the code is edited.  If you indent consistently and
you ``waste'' space to put nice big blank areas between the units in which
you write your code, the comment-on-the-close-brace is superfluous.  Indeed,
if you *really* value that blank space, you don't want any needless clutter
in it.  You can recognize what's happening by looking at the big shapes on the
page far faster than you can by reading comments hung off the ends of
brace lines.
 
> Disclaimer : Like all sensible people, I agree that the important point
> is to use a common style - what that style happesn to be is secondary.

Like all sensible people, I will agree so long is it is does not violate my
personal *must not*s !!
-- 

(This man's opinions are his own.)
>From mole-end				Mark Terribile



More information about the Comp.lang.c mailing list