Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch)
Home

[Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Wed, 10 Oct 2001 13:49:39 +0100 (BST)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
>
> Opinions about this?
> 
>    * init vars
>        int foo(struct city *punit)
>       {
>       int x=punit->x;
>       } 
> or
>        int foo(struct city *punit)
>       {
>       int x; 
> 
>       x=punit->x;
>       }

initialization at the time of declaring var can sometimes help very much
to understand the code.  E.g.
  struct *pplayer = unit_owner(punit);
is nice and clear.  Some rules can be made wrt the ordering, like "first
come pure declarations then declarations + initializations"

So I vote 1 here.

>    * empty line after vars
>         int x;
>       x=3; 
> or
>         int x;
> 
>       x=3;

empty line helps.
vote 2.


>    * comments
>        x=3; /* assign 3 to x */ 
> 
> or
>        /* assign 3 to x */
>        x=3;

either way, unless commentary is very long in which case 2.

> 
>    * extra {} on iterates

extra {} do not hurt but I don't really care.

G.

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


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