Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 1996 10:39:38 +0200 (MET DST)
From:      grog@lemis.de (Greg Lehey)
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        chat@FreeBSD.ORG (FreeBSD Chat)
Subject:   Re: Indentation styles
Message-ID:  <199606030839.KAA10660@allegro.lemis.de>
In-Reply-To: <199606021410.QAA01867@uriah.heep.sax.de> from "J Wunsch" at Jun 2, 96 04:10:53 pm

next in thread | previous in thread | raw e-mail | index | archive | help
J Wunsch writes:
>
> As Greg Lehey wrote:
>
>>> The typografical rules say ~ 60 chars per line, everything else has to
>>> be made two-column (a bit impractical for programs :).
>>
>> I've been thinking about this for a while, and I both agree and
>> disagree.  Yes, more than 60 chars per line become difficult to read,
>> but I *do* use dual columns in my programs.  There are these things
>> called comments which I align in a column at the right (starting at
>> column 50 by default).  I don't like it when too many code lines run
>> into the comment columns.
>
> ``comment columns'' are not really sanctioned by KNF.  Look at
> style(9) and into all the 4.4BSD-derived stuff, comments are usually
> aligned at the indent level of the code.  You should not comment each
> and any line, it doesn't make the code better readable nor better
> understandable.

This is very much a matter of opinion.  Obviously not *every* line
requires a comment (lines containing a single { or } are pretty
self-evident :-), but in general kernel code contains far too few
comments.  Where you put the comments is a matter of style, of course.

> Instead, usually a larger block should be commented explaining its
> purpose.  This way, you won't have a need for two-column styled C
> programs.

Of course, if you put the comments where they belong, you wouldn't
have a need for large comment blocks separated from their code.  You
can see this both ways.  In fact, I see a need both for block comments
and line comments.

Greg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606030839.KAA10660>