Re: The order of #include statements

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Tue, 19 Oct 2010 19:40:52 -0600

On 10/19/2010 07:18 PM, Amos Jeffries wrote:
> On Tue, 19 Oct 2010 12:32:35 -0600, Alex Rousskov wrote:

>>>> 3. each src/ file, with a few hard-coded exceptions, must start with
>>>> #include "". If there is no "" to include, include "config.h". Do not
>>>> include "config.h" or "squid.h" if there is another "" include.

>>> Why the exception to not include config.h or squid.h?

>> It simply wastes a little bit of compilation time. If the above rules
>> are followed, config.h or squid.h will always be included at least once
>> per translation unit.

> Um. Deep. Okay on face value it sits pretty.
>
> What is your opinion of breaking the all-dependencies requirement for .h
> in the case of config.h?

> I mean requiring that they include all dependencies, except that config.h
> should ONLY be included by .c/.cc/.cci files. This would fix the loop
> problems with resulting hack we have in compat and the extra precompiler
> time waste.

FWIW, we use ".cc only" rule in other non-library projects and it works
well. If Squid starts building libraries for other programs to use, this
rule will no longer work.

I do not think .cci files need config.h because they are always included
into other files. Or are they not?

> squid.h as it currently exists can't face this exception.

Cheers,

Alex.
Received on Wed Oct 20 2010 - 01:40:55 MDT

This archive was generated by hypermail 2.2.0 : Wed Oct 20 2010 - 12:00:05 MDT