Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2614) activate_all_units
Home

[Freeciv-Dev] (PR#2614) activate_all_units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2614) activate_all_units
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 28 Dec 2002 21:47:59 -0800
Reply-to: rt@xxxxxxxxxxxxxx

[kauf - Fri Dec 20 16:08:30 2002]:

> On Fri, Dec 20, 2002 at 12:15:58AM -0800, Jason Short via RT wrote:
> > 
> > This patch provides a client-common code to activate all units on a
> > given tile.  It is called by citydlg code when "activate all units" is
> > selected.
> > 
> > The name could be questionable.
> 
> why do you remove the type-casting?

Type-casting from a void* to a different type of pointer is unnecessary
in C.  Giving the cast can conceal other errors, since the type-cast
will generally make the assignment succeed even when it shouldn't.  It's
also less readable IMO.  This is closely related to why NULL is often
#defined to ((void*)0), and see also
http://www.eskimo.com/~scs/C-faq/q7.7.html.

In C++, a cast is needed.  At some point some pieces of freeciv code
were given explicit casts for this reason.  But I believe the better
solution is to use 'extern "C"' wrappers if and when the code needs to
be compiled with C++.  Note that there are other incompatabilities
between C and C++.

jason



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