Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...