在C和C转换单元++ [英] Translation unit in C and C++

查看:192
本文介绍了在C和C转换单元++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么之间转换单元是C ++和差C?

Is there a difference between what a translation unit is in C++ and C?

在其他职位,我读了一个头文件和源文件,使一个翻译单元,但
可以将源文件单独被称为翻译单元在C ++中它包含在一个文件中的所有定义?

In other posts, I read that a header and source file makes a translation unit, but can a source file alone be called a translation unit in C++ where it contains all the definitions in one file?

推荐答案

一个翻译单位是不是一个头和一个源文件。它可能包括一个千年的头文件(和千源文件也是如此)。

A translation unit is not "a header and a source file". It could include a thousand header files (and a thousand source files too).

一个翻译单元简直就是通常被称为源文件或.cpp文件被preprocessed后。如果源文件的#include S其他文件这些文件的文本被包含在由preprocessor翻译单元。目前在这个问题上C和C ++之间没有差异。

A translation unit is simply what is commonly known as "a source file" or a ".cpp file" after being preprocessed. If the source file #includes other files the text of those files gets included in the translation unit by the preprocessor. There is no difference between C and C++ on this matter.

这篇关于在C和C转换单元++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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