3 - [basic] - 【基本】

来源:互联网 发布:百度管家for mac 编辑:程序博客网 时间:2024/05/20 06:04
请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 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.

 

名字是对指示一个实体或标签(6.6.4,6.1)的标识符(2.10)的使用。变量由对对象的声明引入。变量的名字指示该对象。

 

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).

 

一些名字指示类型,类,枚举,或模板。在解析一个程序前,通常需要确定某个名字是否指示这些实体。确定这种信息的过程称为名字查找(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.5)。

 

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]上一页 【词法.布尔】 | 下一页 【基本.定义】
原创粉丝点击