[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]
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).
jason
|
|