慢性咽炎挂什么科| 什么叫散光| 送男生什么生日礼物| 益母草长什么样子图片| 灵芝泡酒有什么功效| 生菜是什么菜| 11月14号什么星座| ITIB跟薇娅什么关系| 尿路感染吃什么中成药| 形单影只什么意思| 罗姓男孩取什么名字好| 脾胃虚吃什么调理| 奉子成婚是什么意思| 属猴的是什么命| 胃疼吃什么食物最养胃| 牙齿咬不动东西是什么原因| 生育登记有什么用| 沙漠玫瑰什么时候开花| 欧芹是什么| 什么是职业道德| 覅是什么意思| 什么体质人容易长脚气| 慢性咽炎吃什么药好得快能根治| 多此一举是什么意思| 蛆长什么样子| 狗狗什么时候打疫苗| 梦见吃酒席是什么意思| 额头爱出汗是什么原因| 失聪是什么意思| 女人气血不足吃什么补| 天德是什么意思| 吃石斛有什么作用| 相表里什么意思| 肚子疼吃什么| 儿童细菌感染吃什么药| 翻白眼是什么意思| 蚂蚁爱吃什么东西| 乳腺瘤是什么引起的| 河北有什么山| 心衰是什么病| 痘痘反复长是什么原因| 香蕉为什么不能放冰箱| 翡翠有什么作用与功效| 梦见老公穿新衣服是什么意思| 瓜尔胶是什么东西| 土豆发芽到什么程度不能吃| 储蓄卡是什么意思| 骄阳似火是什么意思| 贡菜是什么| 脾围是什么意思| 上热下寒吃什么食物好| 心慌是什么感觉| 男人遗精是什么原因造成的| 奶奶的姐姐叫什么| 常喝普洱茶有什么好处| 眼角有眼屎是什么原因| 香港迪士尼什么时候开业的| 血容量不足是什么意思| 伪军是什么意思| 后背出汗是什么原因| 头发粗硬是什么原因| 帕金森病是什么原因引起的| 梦见河水是什么意思| 关节炎吃什么药最好| 宋五行属什么| 头痛挂什么科| 静脉血栓吃什么药| 孩子b型血父母什么血型| 打九价是什么意思| 体贴是什么意思| 蒂芙尼算什么档次| 眼睛为什么会痛| 骟是什么意思| 保家仙是什么意思| 五行属性是什么| 被虫咬了挂什么科| 三番四次是什么生肖| 小孩什么时候说话| funfair是什么意思| 楚怀王和芈月什么关系| 完全性右束支传导阻滞是什么意思| 轻食是什么| 梦见殡仪馆是什么意思| 草代表什么生肖| 拉肚子适合吃什么食物| 鼻炎用什么药效果好| 肌炎是什么病| 什么是标准差| 西瓜和什么相克| mA是什么| 少帅是什么军衔| 鲨鱼用什么呼吸| 3月23日什么星座| 需要透析的是什么病| 孕妇子痫是什么病| 年夜饭吃什么| 下巴疼是什么原因| 飞天是什么意思| 为什么感冒药吃了想睡觉| 木木耳朵旁是什么字| 地瓜不能和什么一起吃| 黄加黑变成什么颜色| 退烧药吃什么| 春晓描写的是什么季节| 蓝营绿营什么意思| 12月28是什么星座| 湿疹用什么药好得最快最有效| 右侧卵巢多囊样改变是什么意思| 六月出生的是什么星座| 石榴是什么生肖| 什么时候是安全期| 湿疹擦什么药膏| 怀孕期间吃什么对胎儿发育好| 肾阴虚的表现是什么| 九出十三归是什么意思| mas是什么意思| 梦见骡子是什么意思| 热痱子长什么样| 副鼻窦炎是什么意思| 左眼皮肿是什么原因引起的| 精液是什么组成的| 做梦被杀了是什么征兆| 1月3日是什么星座| 抽搐是什么意思| 什么情况下会得甲亢| 男人梦见血是什么预兆| 漂流穿什么衣服| 虾仁炒什么好吃又简单| 煎饼果子的果子是什么| 三花聚顶是什么修为| 今年30岁属什么生肖| 7月22号是什么星座| 什么的海藻| 吃完饭就想吐是什么原因| 什么心什么心| 鼓的偏旁部首是什么| 舌尖痛吃什么药| 男性性功能减退吃什么药| 迥异是什么意思| 经常饿是什么原因| 媾是什么意思| 暂告一段落是什么意思| 功成名就是什么意思| 四月十号是什么星座| 吃什么补钙快| 胎儿左心室强光点是什么意思| pcl是什么意思| 女同是什么意思| 牙根疼是什么原因| 花千骨最后结局是什么| 维生素c什么时候吃效果最好| 藏红花什么时候喝最好| 菩提树是什么树| 缺营养吃什么补身体最好| 农历五月的别称是什么| 睡觉老是流口水是什么原因| 啤酒加味精有什么作用| 十多块钱的烟什么好抽| 旺夫脸是什么脸型| 难怪是什么意思| 补钙什么季节补最好| 12月24是什么星座| 睡觉流口水什么原因| 乌鸦嘴是什么意思| 生肖蛇和什么生肖相冲| 先期是什么意思| 结婚纪念日送什么礼物| 季夏是什么意思| 洗澡用什么香皂好| 胎儿脐带绕颈是什么原因造成的| feel是什么意思| 梦到老虎是什么意思| 颈椎不好挂什么科| 紧急避孕药有什么危害| 3月17日什么星座| 一个既一个旦念什么| 难舍难分是什么意思| 宫腔粘连是什么意思| 初级会计什么时候拿证| 镶是什么意思| 长期吃优甲乐有什么副作用| 伊朗用什么货币| 血脂高吃什么油好| 农村做什么生意赚钱| 孕妇喝椰子水有什么好处| hs医学上是什么意思| 肾小球是什么| 栩是什么意思| 举重的器材叫什么| 五指姑娘是什么意思| 葛根是什么东西| 十月份出生的是什么星座| 中药饮片是什么意思| 肚脐眼连着什么器官| 莲雾什么味道| 结晶体是什么意思| 左下腹是什么器官| 心梗是什么原因引起的| 木舌是什么字| 清理鱼缸粪便用什么鱼| 县长什么级别干部| 九个月的宝宝吃什么辅食食谱| 反刍什么意思| 随喜赞叹是什么意思| 纳少是什么意思| ml是什么| 1940年中国发生了什么| 支气管舒张试验阳性说明什么| 现在执行死刑用什么方法| 落红的血是什么样子的| 褐色是什么颜色的图片| 复合维生素b什么时候吃最好| 银消病用什么药效果最好| 挺舌反应是什么| 便溏是什么意思| 神经性梅毒有什么症状| 卯木代表什么| 炒熟的黑豆有什么功效| 梅杰综合症是什么病| 眼睛胀痛什么原因| 梦见参加葬礼是什么意思| 你喜欢我什么我改| 2000年是什么龙| 番薯是什么| 麻醉对身体有什么伤害| 领略是什么意思| 轻度强化是什么意思| 为什么不愿意工作| maybach是什么车| 闲鱼转卖什么意思| 淀粉吃多了有什么危害| 手足口是什么| 阴虚吃什么中药| cd是什么| 为什么8到10周容易胎停| 誉之曰的之是什么意思| 肠道有息肉有什么症状| 办理港澳通行证需要什么材料| 小便不利是什么意思| au999是什么金| 女人为什么要嫁人| 十二月九号是什么星座| 低血压吃什么药| 鸽子拉绿稀便是什么病| 三月三日是什么星座| 曼秀雷敦属于什么档次| 双喜临门指什么生肖| 为什么会长痣| 正骨挂什么科| 画像是什么意思| 发热出汗是什么原因| 来月经吃什么水果| m和s是什么意思| 7月出生是什么星座| 失去自我是什么意思| 吃什么食物对心脏好| 咳嗽胸口疼是什么原因| 什么病人要补氯化钾呢| 幽门螺杆菌阳性吃什么药| 什么的帽子| 屎特别臭是什么原因| afp是什么| 造影检查是什么意思| 小腿肌肉抽筋是什么原因引起的| 百度Jump to content

十九大精神知识竞赛——新华网——湖南

From Wikipedia, the free encyclopedia
百度 而公司的投资业务又很多流向与股东相关的项目中。

In computer programming, a precompiled header (PCH) is a (C or C++) header file that is compiled into an intermediate form that is faster to process for the compiler. Usage of precompiled headers may significantly reduce compilation time, especially when applied to large header files, header files that include many other header files, or header files that are included in many translation units. The ideas of precompiled headers were central to the development of C++ modules.

Rationale

[edit]

In the C and C++ programming languages, a header file is a file whose text may be automatically included in another source file by the C preprocessor by the use of a preprocessor directive in the source file.

Header files can sometimes contain very large amounts of source code (for instance, the header files windows.h and Cocoa/Cocoa.h on Microsoft Windows and OS X, respectively). This is especially true with the advent of large "header" libraries that make extensive use of templates, like the Eigen math library and Boost C++ libraries. They are written almost entirely as header files that the user #includes, rather than being linked at runtime. Thus, each time the user compiles their program, the user is essentially recompiling numerous header libraries as well. (These would be precompiled into shared objects or dynamic link libraries in non "header" libraries.)

To reduce compilation times, some compilers allow header files to be compiled into a form that is faster for the compiler to process. This intermediate form is known as a precompiled header, and is commonly held in a file named with the extension .pch or similar, such as .gch under the GNU Compiler Collection.

Usage

[edit]

For example, given a C++ file source.cpp that includes header.hpp:

//header.hpp
...
//source.cpp
#include "header.hpp"
...

When compiling source.cpp for the first time with the precompiled header feature turned on, the compiler will generate a precompiled header, header.pch. The next time, if the timestamp of this header did not change, the compiler can skip the compilation phase relating to header.hpp and instead use header.pch directly.

Common implementations

[edit]

Microsoft Visual C and C++

[edit]

Microsoft Visual C++ (version 6.0 and newer[citation needed]) can precompile any code, not just headers.[1] It can do this in two ways: either precompiling all code up to a file whose name matches the /Ycfilename option or (when /Yc is specified without any filename) precompiling all code up to the first occurrence of #pragma hdrstop in the code[2][3] The precompiled output is saved in a file named after the filename given to the /Yc option, with a .pch extension, or in a file named according to the name supplied by the /Fpfilename option.[3] The /Yu option, subordinate to the /Yc option if used together, causes the compiler to make use of already precompiled code from such a file.[3]

pch.h (named stdafx.h before Visual Studio 2017[4]) is a file generated by the Microsoft Visual Studio IDE wizard, that describes both standard system and project specific include files that are used frequently but hardly ever change.

The afx in stdafx.h stands for application framework extensions. AFX was the original abbreviation for the Microsoft Foundation Classes (MFC). While the name stdafx.h was used by default in MSVC projects prior to version 2017, any alternative name may be manually specified.

Compatible compilers will precompile this file to reduce overall compile times. Visual C++ will not compile anything before the #include "pch.h" in the source file, unless the compile option /Yu'pch.h' is unchecked (by default); it assumes all code in the source up to and including that line is already compiled.

GCC

[edit]

Precompiled headers are supported in GCC (3.4 and newer). GCC's approach is similar to these of VC and compatible compilers. GCC saves precompiled versions of header files using a ".gch" suffix. When compiling a source file, the compiler checks whether this file is present in the same directory and uses it if possible.

GCC can only use the precompiled version if the same compiler switches are set as when the header was compiled and it may use at most one. Further, only preprocessor instructions may be placed before the precompiled header (because it must be directly or indirectly included through another normal header, before any compilable code).

GCC automatically identifies most header files by their extension. However, if this fails (e.g. because of non-standard header extensions), the -x switch can be used to ensure that GCC treats the file as a header.

clang

[edit]

The clang compiler added support for PCH in Clang 2.5 / LLVM 2.5 of 2009.[5] The compiler both tokenizes the input source code and performs syntactic and semantic analyses of headers, writing out the compiler's internal generated abstract syntax tree (AST) and symbol table to a precompiled header file.[6]

clang's precompiled header scheme, with some improvements such as the ability for one precompiled header to reference another, internally used, precompiled header, also forms the basis for its modules mechanism.[6] It uses the same bitcode file format that is employed by LLVM, encapsulated in clang-specific sections within Common Object File Format or Extensible Linking Format files.[6]

C++Builder

[edit]

In the default project configuration, the C++Builder compiler implicitly generates precompiled headers for all headers included by a source module until the line #pragma hdrstop is found.[7]:?76? Precompiled headers are shared for all modules of the project if possible. For example, when working with the Visual Component Library, it is common to include the vcl.h header first which contains most of the commonly used VCL header files. Thus, the precompiled header can be shared across all project modules, which dramatically reduces the build times.

In addition, C++Builder can be instrumented to use a specific header file as precompiled header, similar to the mechanism provided by Visual C++.

C++Builder 2009 introduces a "Precompiled Header Wizard" which parses all source modules of the project for included header files, classifies them (i.e. excludes header files if they are part of the project or do not have an Include guard) and generates and tests a precompiled header for the specified files automatically.

Pretokenized headers

[edit]

A pretokenized header (PTH) is a header file stored in a form that has been run through lexical analysis, but no semantic operations have been done on it. PTH is present in Clang before it supported PCH, and has also been tried in a branch of GCC.[8]

Compared to a full PCH mechanism, PTH has the advantages of language (and dialect) independence, as lexical analysis is similar for the C-family languages, and architecture independence, as the same stream of tokens can be used when compiling for different target architectures.[9] It however has the disadvantage of not going any further than simple lexical analysis, requiring that syntactic and semantic analysis of the token stream be performed with every compilation. In addition, the time to compile scaling linearly with the size, in lexical tokens, of the pretokenized file, which is not necessarily the case for a fully-fledged precompilation mechanism (PCH in clang allows random access).[9]

Clang's pretokenization mechanism includes several minor mechanisms for assisting the pre-processor: caching of file existence and datestamp information, and recording inclusion guards so that guarded code can be quickly skipped over.[9]

Modules

[edit]

Modules, introduced in C++20, function similarly to precompiled headers, and are compiled to .pcm (precompiled module) files, similar to .pch files for precompiled headers. Modules allow greater encapsulation and control of exported symbols, and like precompiled headers allow for faster compilation.[10] Modules are handled entirely by the compiler rather than the preprocessor, and thus unlike precompiled headers, cannot export macros due to being handled after the preprocessing step.

Since C++23, the C++ standard library is provided as a module.[11]

See also

[edit]

Notes

[edit]

References

[edit]
  1. ^ "Creating Precompiled Header Files". MSDN. Microsoft. 2015. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  2. ^ "Two Choices for Precompiling Code". MSDN. Microsoft. 2015. Retrieved 2025-08-06.
  3. ^ a b c "/Yc (Create Precompiled Header File)". MSDN. Microsoft. 2015. Retrieved 2025-08-06.
  4. ^ "Can I use #include "pch.h" instead of #include "stdafx.h" as my precompile header in Visual Studio C++?". Stack Overflow.
  5. ^ "LLVM 2.5 Release Notes". releases.llvm.org.
  6. ^ a b c The Clang Team (2018). "Precompiled Header and Modules Internals". Clang 7 documentation. Retrieved 2025-08-06.
  7. ^ Swart, Bob (2003). Borland C++ Builder 6 Developer's Guide. Sams Publishing. ISBN 9780672324802.
  8. ^ "pph - GCC Wiki". gcc.gnu.org.
  9. ^ a b c The Clang Team (2018). "Pretokenized Headers (PTH)". Clang 7 documentation. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  10. ^ cppreference.com (2025). "Modules (since C++20)". Retrieved 2025-08-06.
  11. ^ cppreference.com (2025). "C++ Standard Library". Retrieved 2025-08-06.
[edit]
清汤寡水是什么意思 蒲公英叶和根的功效有什么不同 心功能iv级是什么意思 什么地听 轻度贫血有什么症状
突破性出血是什么意思 脑梗吃什么食物 为什么会中暑 遍体鳞伤是什么意思 头发发黄是什么原因
上火吃什么可以降火 脑梗吃什么最好 坐怀不乱是什么生肖 大红袍属于什么茶类 小厨宝是什么东西
兴奋剂是什么 什么叫渣男 唐氏筛查高风险是什么意思 蝉蜕是什么 50年是什么婚姻
芒果有什么功效hcv7jop9ns1r.cn 什么书买不到hcv8jop9ns7r.cn 法国的国花是什么花hcv7jop5ns4r.cn 玉兔是什么意思hcv9jop3ns0r.cn 南瓜子吃多了有什么副作用hcv8jop2ns9r.cn
绿鼻涕是什么原因hcv9jop5ns4r.cn 龙生九子是什么生肖hcv9jop5ns2r.cn 老是打嗝是什么病的征兆hcv8jop6ns4r.cn 粉丝是什么做的hcv9jop1ns5r.cn 尿液发臭是什么原因hcv9jop2ns1r.cn
11月18号是什么星座的hcv8jop4ns1r.cn 股票的量比是什么意思creativexi.com 紫河车是什么东西hcv8jop9ns9r.cn 石敢当是什么神hcv7jop4ns8r.cn pe是什么意思hcv8jop3ns2r.cn
鳙鱼是什么鱼hcv8jop6ns2r.cn 什么心竭什么hcv9jop0ns9r.cn 般若波罗蜜是什么意思hcv8jop1ns1r.cn 称中药的小秤叫什么zsyouku.com 来之不易是什么意思hcv9jop4ns7r.cn
百度