我们可以应用没有明确引用从C ++标准的规范性引用的内容吗? [英] Can we apply content not explicitly cited from the normative references to the C++ standard?

查看:160
本文介绍了我们可以应用没有明确引用从C ++标准的规范性引用的内容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++ 11标准( 最近草案is N3337 )section 1.2 规范参考说:



< blockquote>

以下引用的文档对于本文档的
应用程序是不可或缺的。对于注日期的引用文件,只有引用的版本
适用。对于未注明日期的引用,最新版本的
引用文件(包括任何修订)适用。


关于如何应用参考。容易的情况是当C ++ 11显式地引用回一个引用,例如在 3.9.1 基本类型中,它说: / p>


[...]签名和无符号整数类型应满足C标准第5.2.4.2节中给出的
约束.1。


但是对于没有明确引用的其他情况呢?例如,C ++ 11使用单词 indeterminate value ,但它没有定义该术语。规范性参考文献包括:


- ISO / IEC 9899:1999,编程语言 - C





- ISO / IEC 9899:1999 / Cor.3:2007(E),编程语言-C,技术勘误3


和C99( draft c99标准 )在 3.17.2 中有不确定值的定义c $ c>其中说:


未指定的值或陷阱表示


是否正确地说,不确定值是通过引用C99定义的C ++ 11,如这个答案似乎对位的定义?如果是,则 部分 的类型在C99?



慷ous的读法是,只要C ++ 11中没有任何内容与规范引用冲突,那么它适用,这是正确的解释吗? 一些问题的答案是C ++中的不确定的行为?它与未定义的行为有什么不同?似乎意味着一个大方的阅读,虽然语言在一些答案中有点松散,所以很难说出在某些点上究竟要求什么。

解决方案

ISO标准文档的规范引用部分的功能在 ISO / IEC指令,第2部分,2011年§6.2.2:


6.2.2规范参考




中引用的引用文件列表(见6.6.7.5),以使其成为文件应用必不可少的方式。对于注明日期的引用文件,每个引用文件应以其出版年份给出,或者在查询或最终草案的情况下,带有短划线以及脚注待公布和完整标题。出版年份或破折号不得注明未注明日期的引用文件。当未注日期的引用针对文件的所有部分时,公布号后应紧接着(所有部分)的说明和部分系列的总标题(即介绍性内容和主要内容,见附件E)。



原则上,参考文件应为ISO和/或IEC出版的文件。
其他机构发布的文件可以规范的方式提及,但



a)参考文件由ISO和/或IEC委员会认可作为具有广泛接受和权威地位并且可公开获得的
,b)b)b)b)b)b)b)b)b)b)b)b)b)或
出版商(在已知的情况下)的引用文件以及其根据需要提供的
- 作者或出版商将被要求根据请求提供
文件, / p>

c)作者或出版商(如果知道)也同意通知ISO和/或IEC
委员会他们打算修改参考文件, b)b)b)b)b)b)b)b)b)d)ISO和/或IEC委员会承诺根据
引用文档中的任何更改。



该列表将通过以下措辞介绍:


文件,全部或部分,在该
文件中被规范地引用,并且对于其应用是必不可少的。对于注日期的引用文件,只有引用的版本
适用。对于未注明日期的引用,最新版本的引用文件
(包括任何修改)适用。


也适用于多部分文档的一部分。



此列表不包括以下内容:




  • 不公开;


  • 参考文件,仅以信息方式引用;


  • 参考文件,只是在文件准备过程中作为书目或背景资料。




这些参考文件可以列在参考书目中(见6.4.2)。


它并没有说引用文档的内容被合并到当前文档中。基本上,它作为在文档中以某种方式规范引用的所有其他标准文档的列表。



,例如,C99被并入C ++ 11中 - 仅C99的被特别引用为并入C ++ 11标准中的那些部分。


In the C++11 standard(closest draft is N3337) section 1.2 Normative references says:

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

but there are no guidelines on how to apply the references. The easy cases are when the C++11 explicitly refers back to a reference, for example in section 3.9.1 Fundamental types it says:

[...]The signed and unsigned integer types shall satisfy the constraints given in the C standard, section 5.2.4.2.1.

But what about other cases where there is no explicit reference? For example, C++11 uses the word indeterminate value but it does not define the term. The normative references include:

— ISO/IEC 9899:1999, Programming languages — C

[...]

— ISO/IEC 9899:1999/Cor.3:2007(E), Programming languages — C, Technical Corrigendum 3

and C99(draft c99 standard) does have a definition for indeterminate value in section 3.17.2 which says:

either an unspecified value or a trap representation

Is it correct to say that indeterminate value is defined C++11 by reference to C99, like this answer seems to do for the definition of bit? If yes, what about trap representation which is covered in in section 6.2.6.1 paragraph 5 under Representations of types in C99?

The generous reading would be that as long as nothing in the C++11 conflicts with a normative reference then it applies, is this the correct interpretation? Some of the answers to What is indeterminate behavior in C++ ? How is it different from undefined behavior? seem to imply a generous reading, although the language is a bit loose in some of the answers, so it is hard to tell what exactly is being claimed on some points.

解决方案

The function of the Normative References section of an ISO standard document is defined in ISO/IEC Directives, Part 2, 2011 §6.2.2:

6.2.2 Normative references

This conditional element shall give a list of the referenced documents cited (see 6.6.7.5) in the document in such a way as to make them indispensable for the application of the document. For dated references, each shall be given with its year of publication, or, in the case of enquiry or final drafts, with a dash together with a footnote "To be published.", and full title. The year of publication or dash shall not be given for undated references. When an undated reference is to all parts of a document, the publication number shall be followed by the indication "(all parts)" and the general title of the series of parts (i.e. the introductory and main elements, see Annex E).

In principle, the referenced documents shall be documents published by ISO and/or IEC. Documents published by other bodies may be referred to in a normative manner provided that

a) the referenced document is recognized by the ISO and/or IEC committee concerned as having wide acceptance and authoritative status as well as being publicly available,

b) the ISO and/or IEC committee concerned has obtained the agreement of the authors or publishers (where known) of the referenced document to its inclusion and to its being made available as required — the authors or publishers will be expected to make available such documents on request,

c) the authors or publishers (where known) have also agreed to inform the ISO and/or IEC committee concerned of their intention to revise the referenced document and of the points the revision will concern, and

d) the ISO and/or IEC committee concerned undertakes to review the situation in the light of any changes in the referenced document.

The list shall be introduced by the following wording:

"The following documents, in whole or in part, are normatively referenced in this document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies."

The above wording is also applicable to a part of a multipart document.

The list shall not include the following:

  • referenced documents which are not publicly available;

  • referenced documents which are only cited in an informative manner;

  • referenced documents which have merely served as bibliographic or background material in the preparation of the document.

Such referenced documents may be listed in a bibliography (see 6.4.2).

It notably does not say that the contents of the referenced documents are incorporated into the current document. Essentially it serves as a list of all the other standard documents that are in some way normatively referenced elsewhere in the document.

So not everything in, e.g., C99 is incorporated into C++11 - only those parts of C99 specifically referenced as being incorporated in the C++11 standard.

这篇关于我们可以应用没有明确引用从C ++标准的规范性引用的内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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