预编译头?我们真的需要它们 [英] Precompiled Headers? Do we really need them
问题描述
很久以前,我曾经使用预编译的头文件:a。加速编译和b。因为我支持多种开发工具,如CodeWarrior,MPW,VS,ProjectBuilder,gcc,intel编译器等。
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.
现在我有一个Mac Pro与32gb的RAM。
Now I have a Mac Pro with 32gb of RAM.
现在我只使用CMake。
Now I use just CMake.
那么我们真的需要预先编译的标题吗?
So do we really need pre-compiled headers any more?
见/知道?
如何创建跨平台预编译头?也许这也会简化我的生活。
How can one make a cross-platform pre-compiled header? Maybe that would simplify my life too.
推荐答案
没有这样的东西, TDD的支持者(测试驱动的开发)将会失败,如果他们的构建需要更长的时间几秒钟,因为它使他们的开发风格的转换慢得多。
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.
有关详情,请参阅护理和喂养编译标题
这篇关于预编译头?我们真的需要它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!