some sourcefiles will get includes
they strictly speaking did not need.

That is what I meant. our pch.h contains headers that are not commonly
used. (and in pch mode, they are included.)

| In pch mode,
| --include=pch.h is passed. This will *not* work with msvc since msvc
| scans source file for a stopping header file like stdafx.h. (Of
| course, bugger off msvc)

What is a 'stopping header file'?

For example, in a typical ms c++ file, it has

#include <stdafx.h>
#cinldue <others.h>

stdafx.h contains all commonly used headers. msvc knows from a
compiler flag (or by default) that stdafx.h (stopping header) is
pre-processed and skip it.


| > | 2. pch.cpp with
| > |    #include <pch.h>
| > why?
|

I don't quite understand what the pch.cpp file is needed for at all...

Gcc has that -cxx-header (?) option that generate pch from a pch.h
file, but msvc needs a source file to do that. If you have functions
that will be called by all others, they can be put into pch.cpp as
well (to be precompiled). That is why we need an empty (#include
<pch.h> only)  pch.cpp.

| For msvc. Again, if pch.h is what it is supposed to be, include
| <pch.h> is not intrusive.

Sure it is. The only reason you include it is to accomodate the
compiler.

Maybe I have not seen many projects, but nobody else uses our
--include=pch.h approach. Your claim that #include pch.h is intrusive
is indeed alien to me.

Bo

Reply via email to