C Programming Style -- New thought

Bill Crews bc at cyb-eng.UUCP
Mon Jul 29 08:00:56 AEST 1985


> A related issues is whether it is "worth it", in the same tradeoff, to have 
> an extra line for '{' or for '}'.  (My personal opinion is "no" for the
> former and "yes" for the latter.)

Although most programmers in the early sixties used horizontal white space
very little, rather typing "i=i+1" into their Fortran compilers, most today
seem to value horizontal white space and thus use it ("i += 1").  I think
this is a significant, though small, advance.  It does, however, cause the
right margin to become more of a problem.

I think vertical white space is also useful in achieving greater readability.
When reading code, especially code which is unfamiliar and uncommented, breaks
at logical intervals (before for statements, around comments, etc) are *very*
valuable.  Also, putting the { on its own line allows the { and } to be
aligned and likewise adds white space.  Clearly, the bottom edge of the screen
or printed page becomes more of a problem.

> Incidentally, I avoid printouts wherever possible in developing code:  I use
> them only when I cannot get to a terminal for some reason -- I cannot
> imagine circumstances in which my preference would be the other way around.
> (Well, maybe 300 baud ...)

I find 24 x 80 to be a quite small and confining window.  Try using Star- or
Sun-like screen some time.  They can spoil one easily.  Since I don't have one
myself, I get listings more often than I would otherwise.  Perhaps one day soon
we'll be freed from this norm form the past (sigh).
-- 

  /  \    Bill Crews
 ( bc )   Cyb Systems, Inc
  \__/    Austin, Texas

[ gatech | ihnp4 | nbires | seismo | ucb-vax ] ! ut-sally ! cyb-eng ! bc



More information about the Comp.lang.c mailing list