编程语言

img lynnboy

1.4 - [intro.compliance] - 【介绍.遵从性】

发表于2004/10/29 11:46:00  1076人阅读

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

1 General [intro]

1.4 Implementation compliance [intro.compliance]

 

1 综述 【介绍】

1.4 实现遵从性 【介绍.遵从性】

 

The set of diagnosable rules consist of all syntactic and semantic rules in this International Standard except for those rules containing an explicit notation that "no diagnostic is required" or which are described as resulting in "undefined behavior."

 

可诊断规则的集合包括本国际标准中除了被明确标记为“无需诊断”或描述为导致“未定义行为”的规则外的所有语法和语义规则。

 

Although this International Standard states only requirements on C++ implementations, those requirements are often easier to understand if they are phrased as requirements on programs, parts of programs, or execution of programs. Such requirements have the following meaning:
  • If a program contains no violations of the rules in this International Standard, a conforming implementation shall, within its resource limits, accept and correctly execute3) that program.
     
  • If a program contains a violation of any diagnosable rule, a conforming implementation shall issue a least one diagnostic message, except that
     
  • If a program contains a violation of a rule for which no diagnostic is required, this International Standard places no requirement on implementations with respect to that program.

 

虽然本国际标准只是陈述了 C++ 实现的规格要求,但将它们当作程序,程序片段,程序执行的规格要求通常更容易理解。这些规格要求包含以下含义;
  • 如果程序不违反本国际标准的规则,符合标准的实现应该在其资源限制下,接受并正确执行3)这个程序。
     
  • 如果程序违反了任何可诊断规则,符合标准的实现应该给出至少一条诊断消息,除非
     
  • 如果程序违反了无需诊断的规则,对于这个程序本国际标准将不对实现实施任何规格要求。

 

For classes and class templates, the library clauses specify partial definitions. Private members (clause 11) are not specified, but each implementation shall supply them to complete the definitions according to the description in the library clauses.

 

对于类和类模板,库条款指定了它们的部分定义。虽然没有具体指定,但每个实现都应该提供私有成员(章节11)来将定义按照标准库条款的描述完成。

 

For functions, function templates, objects, and values, the library clauses specify declarations. Implementations shall supply definitions consistent with the descriptions in the library clauses.

 

对于函数,函数模板,对象和值,库条款规定了它们的声明。实现应该提供与库条款的描述一致的定义。

 

The names defined in the library have namespace scope (7.3). A C++ translation unit (2.1) obtains access to these names by including the appropriate standard library header (16.2).

 

在库中定义的名字具有名字空间作用域(7.3)。C++ 翻译单元(2.1)可通过包含相应的标准库头(16.2)来获取访问这些名字的能力。

 

The templates, classes, functions, and objects in the library have external linkage (3.5). The implementation provides definitions for standard library entities, as necessary, while combining translation units to form a complete C++ program (2.1).

 

标准库中的模板,类,函数和对象具有外部连接性(3.5)。当将翻译单元合并成完整 C++ 程序(2.1)时,实现应该根据需要提供标准库实体的定义。

 

Two kinds of implementations are defined: hosted and freestanding. For a hosted implementation, this International Standard defines the set of available libraries. A freestanding implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries (17.4.1.3).

 

本国际标准定义了两类实现:寄生实现独立实现。本国际标准为寄生实现定义了一组可用的库。独立实现中的程序执行没有操作系统的支持,而带有实现定义的一组包含特定语言支持的库。

 

A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any well-formed program. Implementations are required to diagnose programs that use such extensions that are ill-formed according to this International Standard. Having done so, however, they can compile and execute such programs.

 

符合标准的实现可以带有扩展(包括附加的库功能),只要这些扩展不会改变任何良好形式程序的行为,。实现应该将使用这些扩展的程序诊断成依据本国际标准为病态形式的。然而,这些程序可以被编译和执行。

 

3)“Correct execution” can include undefined behavior, depending on the data being procesed; see 1.3 and 1.9.

 

3) “正确执行”也可能产生未定义行为,这随被程序处理的数据而定。参见 1.3 和 1.9

 

PREV [defns.well.formed] | NEXT [intro.structure] 上一页 【定义.良好.形式】 | 下一页 【介绍.结构】
阅读全文
0 0

相关文章推荐

img
取 消
img