Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Style question
Home

[Freeciv-Dev] Re: Style question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: f13@xxxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Style question
From: Petrus Viljoen <viljoenp@xxxxxxxxxxx>
Date: Fri, 30 Nov 2001 15:41:59 +0200

Petrus Viljoen wrote:Using a function should result in a smaller working set. 
And the
code can be reused

> without dependencies on variable names.
>
> <DataPtr>  SearchAndReturnCityName( <DataPtr> *list) {
>     while (!(*list) && (!game_find_city_by_name(*list)))  {
>         list++;
>     }
>     return *list;
> }
>
> OR
>
> <DataPtr>  SearchAndReturnCityName( <DataPtr> *list) {
>     while (!(*list) && (!game_find_city_by_name(*(list++))))  ;
>     return *list;
> }
>

Hmm The heat must be getting to me.That wont work.

<DataPtr>  SearchAndReturnCityName( <DataPtr> *list) {
    while (*list && (!game_find_city_by_name(*list)))  {
        list++;
    }
    return *list;
}





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