Precompiled Header(s)



 DEVELOP > c-Plus-Plus > Precompiled Header(s)

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "ma740988"
Date: 04 Jan 2008 10:08:02 PM
Object: Precompiled Header(s)
Section 6.5 of Josuttis, C++ Templates states - and I paraphrase.
"Let's assume for the sake of argument that every file to be compiled
starts with the same N lines of code. We could compile these N lines
and save the complete state of the compiler at that point in a so-
called precompiled header. Then, for every file in our program, we
could reload the saved state and start compilation at line N+1."
Josuttis, went on to state that "In practice this measn the files must
start with the same #include directives, which consume a substantial
portion of our build time".
So given a file called 'std.hpp'. For discussion purposes assume
std.hpp contains the following.
# include <iostream>
# include <string>
# include <vector>
# include <deque>
# include <list>
Later: foo.cpp
# include "std.hpp"
template < typename T >
void confused ( const std::vector < T >& bogus ) {
// stuff
} // end confused
At issue: How can I 'save the complete state of the compiler" such
that any / all changes made to confused wont result in re-compilation
of std.hpp?
.

User: "Ivan Vecerina"

Title: Re: Precompiled Header(s) 05 Jan 2008 02:48:39 AM
"ma740988" <ma740988@gmail.com> wrote in message
news:0e71d277-bfa9-41bb-a8c0-17460d6c2724@i7g2000prf.googlegroups.com...
:
: Section 6.5 of Josuttis, C++ Templates states - and I paraphrase.
:
:
: "Let's assume for the sake of argument that every file to be compiled
: starts with the same N lines of code. We could compile these N lines
: and save the complete state of the compiler at that point in a so-
: called precompiled header. Then, for every file in our program, we
: could reload the saved state and start compilation at line N+1."
....
: At issue: How can I 'save the complete state of the compiler" such
: that any / all changes made to confused wont result in re-compilation
: of std.hpp?
Some compilers just happen to implement a precompiled headers feature,
which may be configured/implemented in various ways.
The complier may for example allow you to specify a special compilation
flag for some files that will trigger the generation of precompiled
header data. Other files, with a different compilation flag, are
then configured to use and load a precompiled header information.
This is all compiler-specific. For more specific information, please
check your compiler's documentation, or ask in a forum dedicated
to the compiler/platform you use.
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER