[Freeciv-Dev] Re: Coding Style Guidelines
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
- [Freeciv-Dev] Re: Coding Style Guidelines, (continued)
- [Freeciv-Dev] Re: Coding Style Guidelines, Mike Kaufman, 2002/01/11
- [Freeciv-Dev] Re: Coding Style Guidelines, Raimar Falke, 2002/01/11
- [Freeciv-Dev] Re: Coding Style Guidelines, Chris Richards, 2002/01/11
- [Freeciv-Dev] Re: Coding Style Guidelines, Raimar Falke, 2002/01/12
- [Freeciv-Dev] Re: Coding Style Guidelines, Mike Kaufman, 2002/01/12
- [Freeciv-Dev] Re: Coding Style Guidelines, Ross W. Wetmore, 2002/01/13
- [Freeciv-Dev] Re: Coding Style Guidelines, Tony Stuckey, 2002/01/14
- [Freeciv-Dev] Re: Coding Style Guidelines, Per I. Mathisen, 2002/01/14
- [Freeciv-Dev] Re: Coding Style Guidelines, Erik Sigra, 2002/01/23
- [Freeciv-Dev] Re: Coding Style Guidelines, Reinier Post, 2002/01/12
[Freeciv-Dev] Re: Coding Style Guidelines,
Gregory Berkolaiko <=
|
|