[Bf-committers] CVS commit: (when to #include config.h)

James Turner bf-committers@blender.org
Tue, 26 Nov 2002 12:35:54 +0000


On Monday, November 25, 2002, at 11:16  am, Unprivileged User wrote:

>
>   Log:
>   Did all of the .h's in source
>   (adding)
>   #ifdef HAVE_CONFIG_H
>   #include <config.h>
>   #endif
>
>   also the Makefile.in's were from previous patch adding
>   the system depend stuff to configure.ac
>
Sorry to be a pain, but (I think) this is not a good idea / standard 
practice. As I understand it, every object file should have the #ifdef 
HAVE_CONFIG block as the first couple of lines, and *no* header file 
should. This should guarantee the values are always available to every 
other header file correctly.

Since you've already done all the .c  / .cpp files, it just seems 
redundant. Also, if someone forgets to to add the #ifdef .. block in a 
new source file, it's not obvious when errors occur, because some 
headers may still pull it in (just delayed a bit). I mention this 
because I've actually done it.

Of course since you have the guard blocks it's totally harmless, not a 
big deal.

H&H
James