Complete.Org: Mailing Lists: Archives: freeciv-dev: June 1999:
Re: [Freeciv-Dev] Programing style
Home

Re: [Freeciv-Dev] Programing style

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: Re: [Freeciv-Dev] Programing style
From: Reinier Post <rp@xxxxxxxxxx>
Date: Fri, 11 Jun 1999 00:57:48 +0200

> Since in C, enums really do correspond directly to integers,
> I don't see a real problem in converting between the two, 
> though it would be good practice to use the explicit enum types 
> where feasible.  Whether its worth converting stuff to use
> unions I'm not sure.

The problem I encountered when I tried that approach (for a patch
to introduce city build queues) was that C doesn't allow union values
to be distinquished by type.  This

union build_item {
  enum unit_type unit;
  enum improvement_type improvement;
};

is useless because it's impossible to tell whether a build_item is
actually a unit or a improvement.  At least, that's what K&R told me.

-- 
Reinier

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