Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] Re: (PR#13460) consistent names for index-to-pointer looku
Home

[Freeciv-Dev] Re: (PR#13460) consistent names for index-to-pointer looku

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13460) consistent names for index-to-pointer lookups
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Tue, 12 Jul 2005 11:37:39 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13460 >

Jason Short wrote:
> 
>   struct unit_class *get_unit_class(Unit_type_id type);
> 
> Note that get_unit_class is put at the end.  This isn't actually an
> index-to-pointer lookup function but it has the exact same name form as
> most of the existing index-to-pointer lookups!  This is very bad
> (solution is to rename it and change its parameter to a struct unit_type
> *, or just to remove it).

  unit_type_get_class()? Why pointer? Most (future) users will need 
class for certain unit, not unit_type: unit_type_get_class(punit->type) 
vs unit_type_get_class(index_to_unit_type(punit->type))

  Which leads to another function name scheme question. If function to 
get class for single unit is ever introduced, should it be named 
unit_get_class()? That seems too easy to confuse with 
unit_type_get_class(). Maybe unit_instance_get_class()?


  - ML





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