Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

c++ - Precompiled Headers? Do we really need them

Back a long time ago I used to use pre-compiled headers: a. to speed compilation and b. because I supported multiple development tools like CodeWarrior, MPW, VS, ProjectBuilder, gcc, intel compilers, etc, etc.

Now I have a Mac Pro with 32gb of RAM.

Now I use just CMake.

So do we really need pre-compiled headers any more?

Are there obvious benefits that I just dont see/know?

How can one make a cross-platform pre-compiled header? Maybe that would simplify my life too.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no such thing as a build that is "Fast enough". Proponents of TDD (Test-Driven Development) will be upset if their build takes longer than a few seconds because it makes turnaround on their development style much slower.

I've worked on projects with hours of compilation time that we halved (or better) by working with pre-compiled headers the right way, so the benefit can be quite large especially for projects that have neglected build times for a while.

However, the preferred solution remains that compilation times never get that far out of hand, by controlling the physical dependencies of the code.

For more information read The Care and Feeding of Pre-compiled Headers


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...