C commenting style?

Charles Day cedayiv at gmail.com
Wed Jan 30 07:11:46 EST 2008


On Jan 30, 2008 3:01 AM, Christian Stimming <stimming at tuhh.de> wrote:

> Quoting Charles Day <cedayiv at gmail.com>:
> > What is GnuCash's preferred format for adding multi-line comments within
> the
> > code of a C function?
>
> AFAIK there still isn't a preferred format for the whole project.
> There was a long indentation discussion including comment format at
> http://lists.gnucash.org/pipermail/gnucash-devel/2007-March/020099.html .
> At
> the time the discussion ended with some sort of consensus but without
> any action to actually implement that consensus.


I read through the thread. I looks like what was proposed was style 1. (By
the way, I'm with you and Josh as far as braces are concerned... I prefer
-bli0 and I find -br incredibly hard to read.)


> Hence, we're back to
> the status quo which is "stick to the style that already exists in the
> file" but apart from that you can do whatever you prefer.
>
> As for your actual proposals:
>

Just to be clear, I'm not proposing anything... this is just a list of
styles that I saw in the existing GnuCash code, and I'm trying to find out
which style is preferred.


> > --- Style 1 ---
> > /* comment line 1
> >  * comment line 2 */
> >
> > --- Style 2 ---
> > /* comment line 1
> >    comment line 2 */
> >
> > --- Style 3 ---
> > /* comment line 1 */
> > /* comment line 2 */
> >
> > --- Style 4 ---
> > /* comment line 1
> >  * comment line 2
> >  */
> >
> > --- Style 5 ---
> > /*
> >  * comment line 1
> >  * comment line 2
> >  */
> >
> > --- Style 6 ---
> > // comment line 1
> > // comment line 2
> >
> > My personal preference has always been style 6,
>
> Although my personal preference would be style 6, too, some older
> compilers would still barf on those C++ / C99 comments. However, I'm
> also not sure whether it is of any value to be considerate of non-C99
> compilers (i.e. C89) as I think we have plenty of C99 constructs
> already in the code.
>

There are already C++/C99 comments in GnuCash (engine/Transaction.c for
example) so maybe these work OK... I guess unless someone says otherwise,
I'll use style 6. If consistency is the issue, well, the file I'm working on
is already quite inconsistent - for those places that have comments at all!
If I can use style 6, then I have no problem quickly going through the
entire file that I'm working on and making it use this style consistently
(gotta love vi).

-Charles

Definitely avoided should be style 3, and maybe to a lesser extent style 1.
>
> Regards,
>
> Christian
>


More information about the gnucash-devel mailing list