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

Then they should be regenerated/reviewed.

I actually only looked at src/mathed/pch.h. But if pch.h indeed has
headers that are commonly included, why not include it and remove
duplicate include lines in the source files?

| > 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.

Use #pragma hdrstop instead.

We do not have this in .C either. As I have said, I see no reason why
not include pch.h.

I understand...

so a pch.cpp that is only used for win only needs to contain:

#include "pch.h"
#pragma hdrstop pch.pch

And then we only need to add /Fp compiler option pointing at pch.pch.

I need good examples to understand this properly.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_PREDIR_hdrstop.asp

Then we can by adding a pch.cpp, avoid adding #include "pch.hpp" to
all files....

I guess so, have not read that page carefully. If all pch.cpp are
alike, I (scons)  can generate it on the fly.

 but are msvc clever enough to avoid duplicate reading of
include files that exists both in pch.hpp and in file.hpp?

I do not know. Peter may have an answer to that. Obviously, #include
pch.h, and remove duplicate header files is safer. (And even if there
are duplicate header files, it will not be processed because of the
ifdef mechanism.)

Bo

Reply via email to