[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reasons for having no inclusion guards in config.h

From: John Calcote
Subject: Re: reasons for having no inclusion guards in config.h
Date: Sun, 07 Mar 2010 17:08:30 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20100227 Thunderbird/3.0.3

On 3/7/2010 4:38 PM, Carsten Heinrici wrote:
but: if there is this golden rule to always have them included first,
there should be no harm if they would include inclusion guards.

what am I missing here?
There may be several config.h files, each of which has somewhat different
content.  Bing!
How do you include several config.h files?
In general, a C file starts with

#if defined(HAVE_CONFIG_H)
#  include "config.h"

This would never include more than one, I think.

Ultimately, I think folks who include config.h in more than one of their own header files (non-public ones, hopefully) are worried that config.h may be included more than once by their own source files that include more than one of these internal headers. They could solve this potential problem like this:


#    include "config.h"
#  endif


#endif    /* INTERNAL_H_INCLUDED */

But that's more painful than they want. Why should they have to define an include guard for config.h? They don't do it for others? What it comes down to is this: It's a difficult problem to generate a unique include guard for config.h.


reply via email to

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