[C++-sig] Pyste suggestion: MSVC precompiled headers support

Niall Douglas s_sourceforge at nedprod.com
Sat Oct 11 00:46:18 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10 Oct 2003 at 19:16, Nicodemus wrote:

> Don't know though how we could make such prohibition, because nothing
> stops the user from writing a PCHInclude in a pyste file and then
> PCHInclude again in another, and then running pyste in multiple mode
> passing only one of them. I think it's ok to let the user take care
> about that.

I was more thinking of a warning if there is more than one PCHInclude 
eg; WARNING: Not compatible with GCC v3.4.

> #ifdef _MSC_VER
> #pragma hdrstop
> #endif    
> 
> Not only the #ifdef part... 8)

#pragma hdrstop tells MSVC to either stop making a precompiled header 
(when creating one) or to start compilation as normal (when using 
one).

I'll expand below.

> A = Class('A', 'A.h')
> PCHInclude('stdfx.h')
> 
> The generated file:
> 
> // Boost Includes 
> =============================================================> #include <boost/python.hpp>
> #include <boost/cstdint.hpp>
> 
> // PCH 
> =====================================================================> === #include <stdfx.h>
> 
> // Includes 
> ===================================================================> #include <A.h>
> 
> 
> Is enough for PCH support?

It isn't for v3.4 of GCC I don't think. It should instead be:

> A = Class('A', 'A.h')
> PCHInclude('common.h')

I don't use stdafx.h here because it smells of MFC which I personally 
dislike. Aesthetically, it isn't nice IMHO (like my view of hungarian 
notation).

> The generated file:
> 
> // PCH 
> =================================================================> #include "common.h"
> #ifdef _MSC_VER
> #pragma hdrstop
> #endif
> 
> // Includes 
> =================================================================> #include <A.h>
> ...

The PCH file must be the FIRST include and the ONLY precompiled 
header for v3.4 of GCC at least (I'm guessing they'll improve this 
with time). For MSVC you can have as many headers as you like before 
the #pragma hdrstop. It should be the user's responsibility to ensure 
common.h includes <boost/python.hpp> and anything else.

The above gives the maximum flexibility to users AFAICS. Comments 
from the group?

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBP4c2u8EcvDLFGKbPEQL/iACfRj4zUqaDFkF/+SYSvd8xvRU81iAAn2X5
HFPernG+02WgkSECzxRFVUJw
=7Zdk
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list