Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: (PR#2306) config.h for all files
Home

[Freeciv-Dev] Re: (PR#2306) config.h for all files

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jason Short via RT <rt@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2306) config.h for all files
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 22:00:47 +0100

On Wed, Nov 13, 2002 at 12:48:57PM -0800, Jason Short via RT wrote:
> Jason Short via RT wrote:
> > Raimar Falke via RT wrote:
> > 
> >>On Mon, Nov 11, 2002 at 12:31:42PM -0800, Jason Short via RT wrote:
> >>
> >>
> >>>Attached is a patch to bring #include <config.h> to every source file.
> >>>
> >>>In addition to the arguments below, there are some practical reasons why 
> >>>this is needed.  Currently config.h #defines 'const', which is used all 
> >>>over the place.  If it changes the definition, right now this will 
> >>>result in changes in only some places, lots of warnings, and (if the 
> >>>definition is necessary) compilation failure.
> >>
> >>
> >>Mhhh. Can you explain me this:
> >>
> >>--- common/netintf.h    2002/02/14 15:17:16     1.4
> >>+++ common/netintf.h    2002/11/13 20:01:58
> >>@@ -18,10 +18,6 @@
> >>   Common network interface.
> >> ***********************************************************************/
> >>
> >>-#ifdef HAVE_CONFIG_H
> >>-#include <config.h>
> >>-#endif
> >>-
> >> #ifdef HAVE_UNISTD_H
> >> #include <unistd.h>
> >> #endif
> > 
> > 
> > The idea is that config.h is included in every .c file, and is therefore 
> > not needed in .h files.
> > 
> > It could be done as you say: include it in every file that "needs" it. 
> > But note that this is harder to maintain, since you have to check this 
> > periodically and/or remember to change it when the files change.  And 
> > it's not likely to net you much, since with all the .h files that need 
> > config.h most or all of the .c files will end up getting it anyway.
> 
> Oh, and note also that some of these preprocessor directives will affect 
> how system header files compile.  For instance NDEBUG affects assert.h, 
> inline affects glib, and const affects all sorts of headers (admittedly 
> these last two might not be an issue since the headers should take care 
> of it themselves).

But your patch didn't add an "#include config.h" on top of map.h.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "A common mistake that people make, when trying to design 
  something completely foolproof is to underestimate the 
  ingenuity of complete fools."
    -- Douglas Adams in Mostly Harmless


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