3 Basic concepts [basic]3.1 Declarations and definitions [basic.def]
| 3 基本概念 【基本】3.1 声明和定义 【基本.定义】
|
A declaration (clause 7) introduces names into a translation unit or redeclares names introduced by previous declarations. A declaration specifies the interpretation and attributes of these names.
| 声明(章节 7)向翻译单元引入名字,或重新声明之前声明的名字。声明指定了这些名字的解释和性质。
|
A declaration is a definition unless it declares a function without specifying the function's body (8.4), it contains the extern specifier (7.1.1) or a linkage-specification24) (7.5) and neither an initializer nor a function-body, it declares a static data member in a class declaration (9.4), it is a class name declaration (9.1), or it is a typedef declaration (7.1.3), a using-declaration (7.3.3), or a using-directive (7.3.4).
| 声明就是定义,除非其声明函数但没有指定函数体(8.4),其包含 extern 限定词(7.1.1)或连接性规范24)(7.5)但没有初始化符或函数体,其在类声明(9.4)中声明静态数据成员,其为一个类名声明(9.1),或其为 typedef 声明(7.1.3),using-声明(7.3.3),或 using-指令(7.3.4)。
|
[Example: all but one of the following are definitions:
whereas these are just declarations:
--end example]
| 【例:下面除了一个全都是定义:
然而这些只是声明:
--例完】
|
[Note: in some circumstances, C++ implementations implicitly define the default constructor (12.1), copy constructor (12.8), assignment operator (12.8), or destructor (12.4) member functions. [Example: given
the implementation will implicitly define functions to make the definition of
--end example] --end note]
| 【注:某些情况下,C++ 实现隐含地定义默认构造(12.1),复制构造(12.8),复制运算符,或析构(12.4)成员函数。【例:给定
实现将隐含地定义函数以使
--例完】 --注完】
|
[Note: a class name can also be implicitly declared by an elaborated-type-specifier (3.3.1).]
| 【注:类名也可能被详细类型限定符(3.3.1)隐含地声明。】
|
A program is ill-formed if the definition of any object gives the object an incomplete type (3.9).
| 如果任何对象的定义为对象指定不完整的类型(3.9),则程序是病态形式的。
|
24) Appearing inside the braced-enclosed declaration-seq in a linkage-specification does not affect whether a declaration is a definition.
| 24) 连接性规范以花括号包围的声明序列中的声明是否是定义不受影响。
|
PREV [basic] | NEXT [basic.def.odr] | 上一页 【基本】 | 下一页 【基本.定义.ODR】 |
3.1 - [basic.def] - 【基本.定义】
请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 24 小时内将其删除;禁止将本文用于商业目的。