Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand
Home

[Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Cc: Markus Linnala <maage@xxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] Small improvement at genlist and maphand
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: Wed, 22 Aug 2001 03:45:24 +0200

On Mon, 20 Aug 2001, xyzzy@xxxxxxxxxxxxx wrote:

>> int get_player_by_id(struct player *pplayer)
>> {
>>     assert(pplayer->player_no >= 0 && pplayer->player_no <
>>     game.max_players); return pplayer->player_no;
>> }
> 
> This function really makes no sense.  What is that assert checking?
> That the player structure pointed to really points to a player
> structure?  It's acceptable to de-reference a player pointer to get
> at the fields, no need to create accessor functions for everything.

I think the idea is to get an immediate core dump when pplayer is bad,
rather than funny errors further down because pplayer->player_no does
not make sense.

But I agree that this is not necessary.

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
Did YOU find a DIGITAL WATCH in YOUR box of VELVEETA?


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