3 - [basic] - 【基本】

请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 24 小时内将其删除;禁止将本文用于商业目的。

3 Basic concepts [basic]


3 基本概念 【基本】


[Note: this clause presents the basic concepts of the C++ language. It explains the difference between an object and a name and how they relate to the notion of an lvalue. It introduces the concepts of a declaration and a definition and presents C++'s notion of type, scope, linkage, and storage duration. The mechanisms for starting and terminating a program are discussed. Finally, this clause presents the fundamental types of the language and lists the ways of constructing compound types from these.


注:本章介绍 C++ 语言的基本概念。本章解释了对象名字的区别,以及它们怎样与左值概念相联系。本章提出了声明和定义的概念,并介绍 C++ 的类型,作用域,连接性,以及存储类型。讨论程序启动与终止的机制。最后,本章介绍这个语言的基本类型,并列出了用它们构造出组合类型的方法。


This clause does not cover concepts that affect only a single part of the language. Such concepts are discussed in the relevant clauses. ]




An entity is a value, object, subobject, base class subobject, array element, variable, function, instance of a function, enumerator, type, class member, template, or namespace.




A name is a use of an identifier (2.10) that denotes an entity or label (6.6.4, 6.1). A variable is introduced by the declaration of an object. The variable's name denotes the object.




Every name that denotes an entity is introduced by a declaration. Every name that denotes a label is introduced either by a goto statement (6.6.4) or a labeled-statement (6.1).


声明引入了每个指示某个实体的名字。每个指示标签的名字由 goto 语句(6.6.4)或标签语句(6.1)引入。


some names denote types, classes, enumerations, or templates. In general, it is necessary to determine whether or not a name denotes one of these entities before parsing the program that contains it. The process that determines this is called name lookup (3.4).




Two names are the same if
  • they are identifiers composed of the same character sequence; or
  • they are the names of overloaded operator functions formed with the same operator; or
  • they are the names of user-defined conversion functions formed with the same type.



  • 它们是由相同的字符序列组成的标识符;或
  • 它们是形成相同运算符的运算符重载函数名字;或
  • 它们是形成相同类型的用户定义转换函数。


An identifier used in more than one translation unit can potentially refer to the same entity in these translation units depending on the linkage (3.5) of the identifier specified in each translation unit.




3.1 Declarations and definitions [basic.def]


3.1 声明和定义 【基本.定义】


3.2 One definition rule [basic.def.odr]


3.2 唯一定义原则 【基本.定义.ODR】


3.3 Declarative regions and scopes [basic.scope]


3.3 声明区域和作用域 【基本.作用域】


3.4 Name lookup [basic.lookup]


3.4 名字查找 【基本.查找】


3.5 Program and linkage [basic.link]


3.5 程序和连接性 【基本.连接】


3.6 Start and termination [basic.start]


3.6 启动与终止 【基本.启动】


3.7 Storage duration [basic.stc]


3.7 存储类型 【基本.存储类型】


3.8 Object Lifetime [basic.life]


3.8 对象生存期 【基本.生存期】


3.9 Types [basic.types]


3.9 类型 【基本.类型】


3.10 Lvalues and rvalues [basic.lval]


3.10 左值和右值 【基本.左值】


PREV [lex.bool] | NEXT [basic.def]上一页 【词法.布尔】 | 下一页 【基本.定义】
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页