一个大(标准::)头文件? [英] One Big (std::) Header File?

查看:100
本文介绍了一个大(标准::)头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现了一个建议,即创建包含所有标准标题的

a标题文件可能是有益的,并且在所有

中包括那些声明来自的地方使用标准库 -

反对包括包含声明的特定标头。有人认为这可能会提高编译速度。意见?

-

如果我们的假设是关于任何事情而不是关于某一个或多个特定事物,那么我们的推论就构成了数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题。 - Bertrand

Russell

I recently came across the suggestion that it might be beneficial to create
a header file containing all the Standard Headers, and include that in all
the places where declarations from the Standard Library are used - as
opposed to including the specific header containing the declaration. It
was argued that this may improve compilation speeds. Opinions?
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

推荐答案



" Steven T. Hatton" ; <苏****** @ setidava.kushan.aa>在消息中写道

新闻:e7 ******************** @ speakeasy.net ...

"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:e7********************@speakeasy.net...
我最近有人提出这样的建议:创建一个包含所有标准头的头文件可能是有益的,并且在所有使用标准库声明的地方都包含它 - 如
反对包含包含声明的特定标头。有人认为这可能会提高编译速度。意见?
-
如果我们的假设是关于任何事情而不是关于某一个或多个特定事物,那么我们的推论就构成了数学。因此,数学可能被定义为我们永远不知道我们在谈论什么,以及我们所说的是否属实的主题。 - Bertrand
Russell
I recently came across the suggestion that it might be beneficial to create
a header file containing all the Standard Headers, and include that in all
the places where declarations from the Standard Library are used - as
opposed to including the specific header containing the declaration. It
was argued that this may improve compilation speeds. Opinions?
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell




我不这么认为。将为每个cpp文件编译所有标题,

包括超级文件。头文件。并非所有内部代码都有用。

仅包含必要的标题。


Catalin



I don''t think so. All the headers will be compiled for each cpp file that
includes that "super" header file. And not all the code inside is useful.
Include only the necessary headers.

Catalin




" Catalin Pitis" < CA *********** @ iquestint.com.renameme>在消息中写道

"Catalin Pitis" <ca***********@iquestint.com.renameme> wrote in message
我不这么认为。将为每个cpp文件编译所有头文件,其中包括超级文件。头文件。并非所有内部代码都有用。
只包含必要的标题。
I don''t think so. All the headers will be compiled for each cpp file that
includes that "super" header file. And not all the code inside is useful.
Include only the necessary headers.




预编译头文件会发生什么?


Sharad



And what happens in the case of precompiled headers ?

Sharad


Catalin Pitis写道:
Catalin Pitis wrote:
我不这么认为。将为每个cpp文件编译所有头文件,其中包括超级文件。头文件。并非所有内部代码都有用。
仅包含必要的标题。

Catalin
I don''t think so. All the headers will be compiled for each cpp file that
includes that "super" header file. And not all the code inside is useful.
Include only the necessary headers.

Catalin




这是传统智慧。 counter参数与

使用预编译头文件有关。我不了解

技术的所有特性,但是解释的方式,支持

预编译头文件的编译器可以跳过所有内容它的第一行是
之前没见过(或类似的东西)。因此,

技术的实用性将取决于实现。我不知道

对预编译头文件的支持有多广泛。海湾合作委员会刚刚介绍了它,而且我不是能够使用最新版本来完成任何需要与我正在运行的KDE一起玩得很好的东西。


我知道一些事情,例如KDE目前可以在24小时内获得更好的部分来构建一个体面的系统。 OSG也可能是一个缓慢的构建。

任何改善构建时间的东西都会受到我的欢迎。

-

如果我们的假设是关于任何东西而不是关于某一个或多个特定的东西,然后我们的推论构成数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题。 - Bertrand

Russell



That is the conventional wisdom. The counter argument has to do with the
use of precompiled headers. I don''t understand all the idiosyncracies of
that technology, but the way it was explained, the compiler that supports
pre-compiled headers can skip everything up to the first line that it
hasn''t seen before (or something like that). So the usefulness of the
technique will be implementation dependent. I don''t know how widespread
support for pre-compiled headers is. GCC just introduced it, and I am not
able to use the latest version for anything that needs to play nicely with
the KDE I''m running.

I do know some things such as the KDE can currently take the better part of
24 hours to build on a decent system. OSG can be a slow build as well.
Anything to improve the build times will be welcomed by me.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell


这篇关于一个大(标准::)头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆