[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]
--- Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx> wrote:
> --- 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.
>
I agree with Greg. 1 for me as well. Raimar, have you checked out the gnome
coding style? It's at
http://developer.gnome.org/doc/guides/programming-guidelines/book1.html
It looks quite nice, with a few mods Freeciv could adopt it. I love the style
of asserts from glib
g_return_if_fail (condition)
Returns from the current function if condition is false.
g_return_val_if_fail (condition, value)
Returns the specified value from the current function if condition is
false.
g_assert (condition)
Aborts the program if condition is false.
g_assert_not_reached ()
Aborts the program if the macro is ever called.
Not sure I like the idea of identing everything 8 spaces though.
> > * empty line after vars
> > int x;
> > x=3;
> > or
> > int x;
> >
> > x=3;
>
> empty line helps.
> vote 2.
>
Same.
>
> > * 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.
>
I prefer selecting one comment method, and I'd really prefer 2.
> >
> > * extra {} on iterates
>
> extra {} do not hurt but I don't really care.
>
No idea, whatever other people want.
> 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
>
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
- [Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28, (continued)
- [Freeciv-Dev] AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/05
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Ross W. Wetmore, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Reinier Post, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/10
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch),
Raahul Kumar <=
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Ross W. Wetmore, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/10
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Ross W. Wetmore, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning, Gregory Berkolaiko, 2001/10/10
- [Freeciv-Dev] Re: AI - cleaning, Ross W. Wetmore, 2001/10/12
[Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28, Gaute B Strokkenes, 2001/10/14
|
|