[Freeciv-Dev] Re: Style question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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;
}
|
|