Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > benefits of precompiled headers

Reply
Thread Tools

benefits of precompiled headers

 
 
unspammable@gmail.com
Guest
Posts: n/a
 
      03-03-2005
Several C++ compilers now allow precompiled headers, supposedly as a
compile-time optimization.
I personally do not use them, although I code mostly in VC++ (which has
a tendency to shove PCH down your throat), because:
a. When headers are lumped together into one huge entity the code loses
a sense of who-uses-what, or so it seems to me. I like to be able to
know from the include directives of each file as much as I can about
the dependecies of that file.
b. I never noticed a significant speed advantage using PCH - although I
never actually timed and compared.

What are you opinions on the matter?
Are there any known disadvantages to using PCH?

 
Reply With Quote
 
 
 
 
Ivan Vecerina
Guest
Posts: n/a
 
      03-04-2005
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Several C++ compilers now allow precompiled headers, supposedly as a
> compile-time optimization.
> I personally do not use them, although I code mostly in VC++ (which has
> a tendency to shove PCH down your throat), because:
> a. When headers are lumped together into one huge entity the code loses
> a sense of who-uses-what, or so it seems to me. I like to be able to
> know from the include directives of each file as much as I can about
> the dependecies of that file.
> b. I never noticed a significant speed advantage using PCH - although I
> never actually timed and compared.
>
> What are you opinions on the matter?


Used properly, precompiled headers do perceivably improve compilation
times. I think this is tangible.

> Are there any known disadvantages to using PCH?


What you mentioned: less clear dependencies. Although there are
other ways to express these in C++ code, for example with namespaces.
And regarding MS-provided headers, anyway, you can hardly really
include "only what you want" (you're stuck with getting the
big blobs with all the macros herein).


Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form


 
Reply With Quote
 
 
 
 
deanbrown3d@yahoo.com
Guest
Posts: n/a
 
      03-04-2005
Our project at work takes about 1/5 of the time to build if you use
PCH. We put includes of all the reasonable static headers, such as
those for windows or VCL or dialogs all into one file, and use that as
the PCH. Most localized headers are left is includes AFTER the pragma
that tells it the PCH are done.

e.g.

#include "CommonHeaderDB4.h" // system headers and non-changing
headers, e.g. vcl.h
#pragma hdrstop

// Local headers
#include "uTrainExpandRoute.h"
#include "uLoadDistThread.h"
#include "fTrainMgr.h"
#include "uTrainSupport.h" //business logic of train for functions
too small to get their own file
#include "uCommonMain.h" //common variables including those
related to projects
#include "uEstimateVolume.h"


Dean

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling ruby.h with precompiled headers Geo Tavros Ruby 0 09-11-2009 05:46 PM
MCSE Benefits... what benefits. Johnny Yi MCSE 51 01-24-2005 02:05 PM
pimpl or precompiled headers? Asfand Yar Qazi C++ 6 04-30-2004 05:04 PM
Reading 'received' headers: Email Headers Parsing dont bother Python 0 03-03-2004 08:18 PM



Advertisments