C commenting style?

Christian Stimming stimming at tuhh.de
Wed Jan 30 06:01:26 EST 2008


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. 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:

> --- 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.

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

Regards,

Christian


More information about the gnucash-devel mailing list