comp.lang.ada
 help / color / mirror / Atom feed
From: "John Duncan" <jddst19+@pitt.edu>
Subject: Re: Comments at the End of Lines
Date: 1999/07/02
Date: 1999-07-02T00:00:00+00:00	[thread overview]
Message-ID: <7lir0r$og1$1@usenet01.srv.cis.pitt.edu> (raw)
In-Reply-To: rracine.20.00079751@draper.com

> Finally, not related to Ada, a C style guide I was asked to review had a
rule
> that said not to put comments at the end of lines.

I'm not exactly sure, but if you consider the C example, comments on the
same line tend to be used to "explain" a very mangled semantic structure. As
far as the meaning of each line is concerned, you shouldn't need comments at
the end of the line. Consider:

Beta := Sqrt(X); -- Assign sqrt(x) to beta

There are a lot of programmers who are told to write comments and put these
things in. It's not good style, obviously. What is good style
is something like:

Obscure := Strange(Odd); -- This actually gets translated to Greek.

When you have something weird to explain that you can't escape.
There's a problem, though, that the space between the semi and the margin is
very small, and you can't explain very well. This example may have been
better as:

Obscure := Strange(Odd);
    -- This actually gets translated into ancient Greek c. 230BC.
    -- Homer wrote the function and no one knows what it does,
    -- but it has faithfully produced the correct value each time.

So that's the best I can do:)

-John






  parent reply	other threads:[~1999-07-02  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-02  0:00 Comments at the End of Lines Roger Racine
1999-07-02  0:00 ` Martin C. Carlisle
1999-07-02  0:00 ` John Duncan [this message]
1999-07-02  0:00   ` Robert Dewar
1999-07-02  0:00   ` Robert Dewar
1999-07-03  0:00   ` Steve Doiel
1999-07-03  0:00     ` John Duncan
1999-07-03  0:00       ` Steve Doiel
1999-07-03  0:00     ` Chad R. Meiners
1999-07-03  0:00     ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox