Precompiled headers and General Parsing of Header File

Kevin Atkinson kevina@clark.net
Wed Jul 29 07:29:00 GMT 1998


Thomas Wagner wrote:
> 
> Does egcs allow for precompiling header files?

I have been meaning to suggest that for a long time.  I am glad you brought it
up.

Also have you considered the idea of not fully parsing the header files with
template information in it ot help speed up compiling of code that uses the
STL.  

By not fully parsing the header file I mean skipping over the class/functions
definitions.  For example:

template <class X>
void long_func (X a, X b) {
  /* very vert long defination
   ...
   ...
   ...
   ...
   ...
  */
}

When reading the above code for the first time the compiler will just take the
inner code and put it into one large block with out parsing it at all (unless
to check for nested {} and } in quotes).

It will then be parsed only when it is instantiated.

This to me would seam to save a lot of time when a lot of unused templates are
included in the header file like with SGI STL.

This idea could even be extended to class information because if the class
never gets called there is no need to know what members it has.

So what do you think of that idea.  Would it help speed up compile time?

Thanks Again.

Kevin Atkinson



More information about the Gcc mailing list