A brace vs. indentation hypothesis (was Re: Braces are not Compiler-Fluff.)
Tainter
tainter at ihlpb.ATT.COM
Wed Jan 11 09:20:27 AEST 1989
In article <305 at twwells.uucp> bill at twwells.UUCP (T. William Wells) writes:
>or, possibly:
>
> if ( p != 0
> && p->barp != 0
> && p->barp->type == BAR_BAZ_TYPE) {
> debazify(p->barp);
> saltpork(p);
> }
or better still (in my not-so-humble opinion):
if (j != 0) {
somefunction(); /* example WITHOUT folded expression */
}
if (p != 0
&& p->barp != 0
&& p->barp->type == BAR_BAZ_TYPE) {
debazify(p->barp); /* example WITH folded expression */
saltpork(p);
}
This has the advantage that your blocks stay uniformly indented. All indents
are in the optimal 4-6 character range (I can point you to a report on
an experiment done on this) and all indents are the same. With a reasonable
editor indents are single key operations (under vi ^T,^D and autoindent do
almost all your indenting) which eliminates multiple keystrokes for these
with consequent better precision. The braces are moderately unobtrusive
without being hard to maintain.
>Bill { uunet!proxftl | novavax } !twwells!bill
--johnathan.a.tainter
More information about the Comp.lang.c
mailing list