C bites / programming style [if

preece at ccvaxa.UUCP preece at ccvaxa.UUCP
Tue Sep 10 01:03:00 AEST 1985


> In my mind, the braces are associaed with the 'if' statment, and so
> they should be indented at the same column as the 'if'.  I look for the
> closing brace in the same column to be a sort of 'statement terminator'
> (i.e. when I see it, I think "Ah, the end of the if statement").
> /* Written 12:35 pm  Sep  4, 1985 by mikes at 3comvax.UUCP in
> ccvaxa:net.lang.c */
----------
Well, in my mind the braces are simply grouping the statements 'under'
the if.  I take the phrase "compound statement" seriously: what comes
after the condition is a single entity made up of zero or more
statements.  Therefore I prefer to put the braces at the same
indentation as the statements they bracket [actually, I prefer to leave
the opening brace dangling on the same line as the condition, so that it
doesn't leave an essentially empty line preceding the bracketed
statements].  This style seems to ME to be closer to the ideal of
having a way of grouping and distinguishing the grouped statements
WITHOUT the syntactic cruft of the braces.  This could be via
indentation-as-syntax, font-as-syntax, or a tokenizing editor, take
your pick.  I see the braces as intrusive extraneous material needed
because we lack proper means to express the structure of the program
directly.

-- 
scott preece
gould/csd - urbana
ihnp4!uiucdcs!ccvaxa!preece



More information about the Comp.lang.c mailing list