Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: Coding Style Guidelines
Home

[Freeciv-Dev] Re: Coding Style Guidelines

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mike Kaufman <mkaufman@xxxxxxxxxxxxxx>, Freeciv-Dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Coding Style Guidelines
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Fri, 11 Jan 2002 12:22:47 +0000 (GMT)

Just 2 comments

 --- Mike Kaufman <mkaufman@xxxxxxxxxxxxxx> wrote: 
>  Freeciv Style Guide
> 
> If you want to hack Freeciv, and want your patches to be accepted, it
> helps to follow some simple style rules. Yes, some of these are a bit 
> nit-picky, but wars are fought over the silliest things...
> 
> - Use K&R indentation style with indentation 2 (if in doubt, use
>   "indent -kr -i2").  However, do not re-indent areas of code you are
>   not modifying or creating.
> 
> - Set lines to 80 columns. Lines should not wrap, ever.
> 
> - An empty line should be placed between two separate blocks of code.
> 
> - Spaces should go before and after operators, and after commas:
> 
> int a,b,c;   /* bad */
> int i, j, k; /* good */
> 
> if(foo<=bar) {   /* all bad */
>   c=a+b;
> }
> 
> if(foo <= bar) { /* good */
>   c = a + b;
> }

this is generally taken care of by indent, but I guess it should be
mentioned explicitly too.
btw, how can I run indent on a part of the code?


> ================================
>  Comments
> ================================
> 
> - Don't use C++-style comments (i.e., // comments).
> 
> - Every function should have a comment header like:
> 
>
/*************************************************************************
>  the description of the function should be here
>  any information is helpful, such as who calls this function, etc.
>  do _not_ introduce a new function without some sort of comment.
>
*************************************************************************/
> int the_function_starts_here(int value) 
> {
>   ...
> }
> 
> - Comments which take more than one line. Asterisks should be placed in
>   front of the comment line like so:
> 
>   /* I am a comment
>    * blah blah 
>    * blah blah */

The democratic voting was in favour of this style:

/* 
 * I am a comment
 * blah blah 
 * blah blah 
 */

But it's ok with me, I voted for  
/* I am a comment
 * blah blah 
 * blah blah  */

(why don't I just keep quite while my undemocratic choice is winning??)

G.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


[Prev in Thread] Current Thread [Next in Thread]