gpt4 book ai didi

c++ - C++ 中的 "translation unit"是什么?

转载 作者:IT老高 更新时间:2023-10-28 11:26:51 28 4
gpt4 key购买 nike

我当时正在阅读Scott Meyers 写的“Effective C++”遇到了“翻译单元”这个词。

谁能给我解释一下:

  1. 究竟是什么?

  2. 在使用 C++ 编程时,我应该何时考虑使用它?

  3. 是只和C++有关,还是可以和其他编程语言一起使用?

我可能已经在不知道这个词的情况下使用它......

最佳答案

来自 here : ( wayback machine link )

According to standard C++ (wayback machine link) : A translation unit is the basic unit of compilation in C++. It consists of the contents of a single source file, plus the contents of any header files directly or indirectly included by it, minus those lines that were ignored using conditional preprocessing statements.

A single translation unit can be compiled into an object file, library, or executable program.

The notion of a translation unit is most often mentioned in the contexts of the One Definition Rule, and templates.

关于c++ - C++ 中的 "translation unit"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1106149/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com