one line comment style

Started by Dan Colishover 16 years ago4 messages
#1Dan Colish
dan@unencrypted.org

I'm going through a few files and trying to clean them up for style mostly and a
bit of refactoring. I am curious about the preferred style for a one line
comment. I see them in both of these forms and I would like to keep it
consistent.

/* a one line comment */

or

/*
* a one line comment
*/

Thoughts?

--
--Dan

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dan Colish (#1)
Re: one line comment style

Dan Colish <dan@unencrypted.org> writes:

I'm going through a few files and trying to clean them up for style mostly and a
bit of refactoring. I am curious about the preferred style for a one line
comment. I see them in both of these forms and I would like to keep it
consistent.

/* a one line comment */

or

/*
* a one line comment
*/

I think either one can be reasonable depending on how important the
comment is, or whether you want more of a visual separation between
separate blocks of code as opposed to an in-line note.

One thing that would be worth checking before you expend too much
manual effort on that is whether pg_indent will convert one style
to the other. Offhand I don't recall that it does, but if it did
then it'd undo your work ...

regards, tom lane

#3Alvaro Herrera
alvherre@commandprompt.com
In reply to: Tom Lane (#2)
Re: one line comment style

Tom Lane wrote:

One thing that would be worth checking before you expend too much
manual effort on that is whether pg_indent will convert one style
to the other. Offhand I don't recall that it does, but if it did
then it'd undo your work ...

No, it doesn't, unless the comment doesn't fit in the line (78 chars IIRC)

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#4Bruce Momjian
bruce@momjian.us
In reply to: Dan Colish (#1)
Re: one line comment style

Dan Colish wrote:

I'm going through a few files and trying to clean them up for style mostly and a
bit of refactoring. I am curious about the preferred style for a one line
comment. I see them in both of these forms and I would like to keep it
consistent.

/* a one line comment */

or

/*
* a one line comment
*/

I use single-line of I just want to comment the next line, and
multi-line if I want to comment on the next block of lines, e.g a
section comment.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +