[Freeciv-Dev] Use of config.h
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Currently <config.h> is #included only by files "that need it". This
means when config.h is changed, only those files will be recompiled.
DEBUG and NDEBUG are not defined within config.h; they are command-line
compilation parameters. This means that when you toggle them you will
have to force recompilation with a "make clean" or some such (very bad,
IMO). But it also means that <config.h> is "needed" in many fewer files
and thus when a small change is made to it only some recompilation is
needed.
Additionally, the question of where config.h is "needed" is tricky. I
think currently it's just been put in where it seems appropriate. But
with the large number of #definitions in the file it is difficult to
determine whether this is correct. A missing inclusion can break things
- sometimes they will be easy to catch (in compilation) and some times
they will cause things to go subtly wrong because the right thing is not
defined.
(An example of when something can go subtly wrong is when a platform has
a broken (or nonstandard) function that is conditionally redefined
somewhere in the header files. But if a .c file doesn't include
config.h, then the original function will be used. Compilation will go
fine, and any error will only show up in runtime and will be very hard
to trace.)
In my opinion, config.h should be included from every .c file. This
will make recompilation take somewhat (2x) longer after config.h is
changed, but will cut down on bugs. It also makes it much easier to add
new things to config.h without having to search to see where they are
needed.
Some background reading:
In which Gaute contemplates the same idea:
http://lists.complete.org/freeciv-dev@xxxxxxxxxxx/2000/09/msg00314.html.gz
In which the pros and cons of #include <config.h> are considered:
http://lists.complete.org/freeciv-dev@xxxxxxxxxxx/1999/06/msg00266.html.gz
In which a missing #include <config.h> gives problems:
http://lists.complete.org/freeciv-dev@xxxxxxxxxxx/1998/11/msg00216.html.gz
jason
- [Freeciv-Dev] Use of config.h,
Jason Dorje Short <=
- [Freeciv-Dev] Re: Use of config.h, Per I. Mathisen, 2002/11/02
- Message not available
- [Freeciv-Dev] (PR#2306) config.h for all files, Jason Short via RT, 2002/11/11
- Message not available
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Raimar Falke via RT, 2002/11/13
- Message not available
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Jason Short via RT, 2002/11/13
- Message not available
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Jason Short via RT, 2002/11/13
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Raimar Falke, 2002/11/13
- Message not available
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Raimar Falke via RT, 2002/11/13
- Message not available
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Raimar Falke via RT, 2002/11/13
- [Freeciv-Dev] Re: (PR#2306) config.h for all files, Raimar Falke, 2002/11/13
|
|