Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#11248) connection.h and spaceship.h should require
Home

[Freeciv-Dev] Re: (PR#11248) connection.h and spaceship.h should require

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: fbriere@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11248) connection.h and spaceship.h should require config.h
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Nov 2004 07:58:20 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11248 >

Frédéric Brière wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=11248 >
> 
> Just spent two hours tracking down this little bugger: there's some
> voodoo in config.h that allows the packing of bools, and not including
> it will affect the layout of struct connection and struct
> player_spaceship.  See attached for a demonstration:

The rule is that every .c file should include config.h *before* 
including any other .h files.

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

Don't include <config.h> in your .h files as that can hide errors.  But 
you may add a

#ifdef HAVE_CONFIG_H
#ifndef FC_CONFIG_H            /* this should be defined in config.h */
#error Files including fcintl.h should also include config.h directly
#endif
#endif

as is done in shared.h and fcintl.h, to catch any errors.

-jason





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