" C ++&QUOT的Ç子集; - >在哪里呢?例子? [英] "C subset of C++" -> Where not ? examples?
本文介绍了" C ++&QUOT的Ç子集; - >在哪里呢?例子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很多书上读到的说法, C是的C子集++ 。
其实一些(?好)书上说:C是C ++的除了小细节的一个子集
I read in a lot of books the claim that "C is a subset of C++".
Actually some (good?) books say: "C is a subset of C++ except the little Details".
我感兴趣的是什么这些细节。我从来没有见过的。
I am interested what these details are. I've never seen one.
推荐答案
如果你比较 C89
与 C ++
然后这里有几件事情
If you compare C89
with C++
then here are a couple of things
int n;
int n; // ill-formed: n already defined
INT []和INT [N]不兼容(没有兼容类型C ++)
int a[1];
int (*ap)[] = &a; // ill-formed: a does not have type int[]
没有K&R的功能定义风格
int b(a) int a; { } // ill-formed: grammar error
嵌套结构具有类范围的C ++
struct A { struct B { int a; } b; int c; };
struct B b; // ill-formed: b has incomplete type (*not* A::B)
无默认INT
auto a; // ill-formed: type-specifier missing
C99增添了一大堆的其他案件
C99 adds a whole lot of other cases
// ill-formed: invalid syntax
void f(int p[static 100]) { }
没有变长数组
// ill-formed: n is not a constant expression
int n = 1;
int an[n];
不灵活的数组成员
// ill-formed: fam has incomplete type
struct A { int a; int fam[]; };
没有限制预选赛帮助别名分析
// ill-formed: two names for one parameter?
void copy(int *restrict src, int *restrict dst);
这篇关于" C ++&QUOT的Ç子集; - >在哪里呢?例子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文