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

[Freeciv-Dev] Programing style

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Programing style
From: Andy Black <ablack@xxxxxxxxxxxxxx>
Date: Tue, 8 Jun 1999 12:42:58 -0600 (MDT)
Reply-to: Andy Black <ablack@xxxxxxxxxxxxxx>

Hi

I am working on a port of Freeciv to the mac
(the web page for the project is
http://www.geocities.com/SiliconValley/Orchard/8378/MFC/)

During my work I have noticed several programing style problems
1. useage of #include <...> for freeciv headers
        I do not know if linux compilers suport this, but I belive that
normal synax for project headers is #include "..." and the normal syntax
for system headers is #include <...>
2. location of #includes
        It is easier to identify the source of a header if the system
headres are in one block and the project headers are in another block.
3. lack of function prototypes
        This is a minor problem that generates errors that can be turned
off
4. inplicit enum conversions
        implicit enum conversions ar things like feeding an int to a
function that requires an enum or returning an int where an enum is
wanted.
        one major source is the currently_building item in the city
struct. if c suports unions, I would do the folowing:

in city.h, struct city
replace
  int currently_building;
with
  union currently_building;
  {
    unit_type_id unit;
    improvement_type_id building;
  }

in functions that use the city struct
replace ocurences of
        curently_building
with    
        curently_building.unit or
        curently_building.building, depending on what the data is being
procesed

Please do not take ofense at these notes, they are just major things I
noticed while starting the conversion.

Andy Black


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