Re: The order of #include statements

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 20 Oct 2010 01:49:37 +0000

On Tue, 19 Oct 2010 19:40:52 -0600, Alex Rousskov
<rousskov_at_measurement-factory.com> wrote:
> 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.

Okay. My vote for making that official then.
It provides a net gain despite the remaining niggle. We can handle that
when it arises.

>
> I do not think .cci files need config.h because they are always included

> into other files. Or are they not?

Right. They are (or should be!).

Amos
Received on Wed Oct 20 2010 - 01:49:40 MDT

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