[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: Bob Friesenhahn
Subject: Re: reasons for having no inclusion guards in config.h
Date: Sun, 7 Mar 2010 19:12:56 -0600 (CST)
User-agent: Alpine 2.01 (GSO 1266 2009-07-14)

On Sun, 7 Mar 2010, John Calcote wrote:

The idea here of course is that the unwanted situation whereby the same config.h file is inadvertently included in the same translation unit twice could be avoided.

As an aside: It's interesting to note that gcc's preprocessor has built-in functionality to automatically guard against this situation.

It is also interesting to note that it is usually ok for the content of the header file to be parsed any number of times. The only exception might be with some weird macro expansion (but that would be a bug).

The conditional inclusion of content is only an optimization. The content of the typical config.h is quite easy to parse. Opening the file to inspect it is surely much more overhead than whatever parsing overhead is saved by the extra conditional. This becomes more and more true as time goes by. In the early '90s the benefit was tangible, but probably not at all any more.

A cost/benefit analysis should show that this effort is not worth doing.

Bob Friesenhahn
GraphicsMagick Maintainer,

reply via email to

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