C和C ++标准之间的关系是什么? [英] What is the Relationship Between the C and C++ Standards?
问题描述
我正在写这个答案,我引用了 http:// en.cppreference.com/w/cpp/string/byte/tolower#Parameters
不能表示为unsigned char和不等于EOF,行为未定义
Is not representable as unsigned char and does not equal EOF, the behavior is undefined
当我去检查已添加此短语的编辑我发现作者的评论:
When I went to inspect the edit that had added this phrase I found that the author's comment:
不能使用每个C99的任何ctype.h函数的负号签名字符7.4 / 1
Can't use negative signed chars with any ctype.h function per C99 7.4/1
作者在C ++文档中引用了C99标准。这是有效的吗?我在C ++标准中找不到这个函数的定义,所以我必须假设它是有效的。
The author is citing from the C99 standard in C++ documentation. Is that valid? I couldn't find anything on the definition of this function in the C++ standard, so I must assume that it is valid.
但是这关系到我的原因有两个: / p>
But this concerns me for 2 reasons:
- 我将如何知道C ++标准所依赖的C标准版本?
- C和C ++之间的差异无处不在的列表。如果我参考C ++查看C标准,怎么可能知道我正在查看的区域是否被覆盖?
- How would I know what version of the C standard the C++ standard depends upon?
- There are lists of the discrepancies between C and C++ everywhere. If I'm looking at the C standard with reference to C++ how could I possibly know whether the area I'm looking at has been overridden?
推荐答案
对于第一个问题:
C ++标准明确列出了它所依赖的C标准规范性引用部分。对于C ++ 14,[intro.refs] 1.2 / 1碰巧列出C 99:
The C++ standard explicitly lists the C standard(s) on which it depends in its Normative references section. For C++14, [intro.refs] 1.2/1 happens to list C 99:
- ISO / IEC 9899:1999,编程语言— C
- ISO / IEC 9899:1999 / Cor.1:2001(E),编程语言C,Technical Corrigendum 1
- ISO / IEC 9899:1999 / Cor.2:2004(E),编程语言& C,Technical Corrigendum 2
- ISO / IEC 9899:1999 / Cor.3:2007(E),编程语言& C,Technical Corrigendum 3
- ISO/IEC 9899:1999, Programming languages — C
- ISO/IEC 9899:1999/Cor.1:2001(E), Programming languages — C, Technical Corrigendum 1
- ISO/IEC 9899:1999/Cor.2:2004(E), Programming languages — C, Technical Corrigendum 2
- ISO/IEC 9899:1999/Cor.3:2007(E), Programming languages — C, Technical Corrigendum 3
对于第二个问题:
C ++标准不会隐含地包含C标准的任何部分;所有对C标准的引用是明确的。 C ++偏离C的一个很好的信息来源是C ++标准的附件C兼容性,特别是C.1 [diff.iso]。
The C++ standard does not implicitly incorporate any parts of the C standard; all references to the C standard are explicit. A good source of information on where C++ deviates from C is Annex C, "Compatibility" of the C++ standard, particularly C.1 [diff.iso].
此外,对C标准库的引用遍及C ++标准库的描述(C ++ 14中的第17章和ndash; 30)。特别感兴趣的可以是:
Additionally, references to the C standard library are scattered throughout the description of the C++ standard library (chapters 17–30 in C++14). Of particular interest can be:
- 17.2 [library.c],其中描述了C标准库的基本包含
- 第18章[language.support],其中描述了C ++标准库的许多
< c :::>
头文件C标准库功能)。
- 17.2 [library.c], which describes the basic inclusion of the C standard library
- Chapter 18 [language.support], which describes many of the
<c:::>
headers of the C++ standard library (those which offer the C standard library functionality).
这篇关于C和C ++标准之间的关系是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!