Proposal for a scientific look at C style choices
Frans van Otten
fransvo at htsa.uucp
Tue Jan 3 18:57:46 AEST 1989
In article <1046 at ns.UUCP> ddb at ns.UUCP (David Dyer-Bennet) writes:
>I think of
> if (cond) {
> /* stuff */
> }
>as one statement, so I like having it begin and end at the same indent
>level. Also, if there happens to be white space or an end of page
>after the closing brace, having that brace at "if" level is the only
>way to put something at that level to stop my eye before it scans on down.
I don't like the begin and the end at the same indent level. The indent
level where the statement begins is where I expect the next statement to
start. So I always write code like this:
if (cond)
{ ...
...
}
nextstatement;
You might say I use a 'half indent' (two spaces) for the {} and a 'full
indent' (four spaces) for the actual code. So I have something to stop
my eye at the end of the compound statement.
The compound statement starts on the same line as the opening {, saving
vertical space. Some people object to this using editing convenience
arguments. That never was a problem to me, though.
--
Frans van Otten
Algemene Hogeschool Amsterdam
Technische en Maritieme Faculteit
fransvo at htsa.uucp
More information about the Comp.lang.c
mailing list