This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PCH, and more generally C++ parser performance



> I claim (and I'd be interested to know if anyone has a counterexample)
> that if an identifier is never used other than to be declared or
> defined, then program behaviour is the same as if those declarations
> were never made.

There are a couple of things that you're of course already aware of, like
constructors and destructors that may have side effects, and the impact
that the existence of a declaration may have on name resolution.

> So, for instance, if we have something like
> 
> #include <everything.h>
> int foo (int bar)
> {
>   bar = f(g(i<3>));
> }
> 
> then during parsing, everything relating to "foo", "bar", "f", "g",
> "i" gets loaded from a pre-compiled header file, as are their types
> and so on.

The only complication I can think of is that
#include <everything.h>
may also instantiate a static file-scope object that has a constructor.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]