Re: [dev] include files should never include include files?

From: Jonathan Slark <>
Date: Sat, 16 Jan 2010 15:52:33 +0000

On 16/01/10 15:41, Joseph Xu wrote:
> This is a little surprising to me as I'm used to putting includes in
> include files all the time. I do use #ifdef header guards, and I've
> never really had any problems violating this rule. So my first question
> is, has anybody actually ran into problems due to violating this rule?
> And secondly, does this rule apply to C++? For example, if I'm defining
> a class that std::vector members, I ordinarily add a #include<vector> in
> the header.

You might not be having problems but he's saying that all that code
passing through the lexical analyser will be slowing the compile down.
If you put the #ifdef in the top file doing the includes then include
files will be opened only the once and not many times.

Received on Sat Jan 16 2010 - 15:52:33 UTC

This archive was generated by hypermail 2.2.0 : Sat Jan 16 2010 - 16:12:02 UTC