有没有下有效的C code将无法定义g正确编译任何情况下++ [英] is there any circumstance under which valid C code will not compile properly using g++

查看:117
本文介绍了有没有下有效的C code将无法定义g正确编译任何情况下++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  “ C ++&rdquo章C子集; - >在哪里呢?例子吗?

据我所知,C是的C子集++(即不存在有效的C code是无效的C ++ code)。我的问题是 G ++ 是否与所有的C code完全兼容。例如,将

I am aware that C is a subset of C++ (i.e. there does not exist valid C code that is not valid C++ code). My question is whether g++ is completely compatible with all C code. For example, will

g++ -o testing test.c

产生一个相同的二进制

produce an identical binary to

gcc -o testing test.c

在任何情况下?

更具体地说,如果他们并不总是创建相同的二进制文件,没有任何理由认为这可能是一个问题吗?它是安全的,总是用 G ++ 如果我不能确定code?

More specifically, if they do not always create identical binaries, is there any reason that that could be a problem? Is it safe to always use g++ if I'm not sure about the code?

推荐答案

C不是C ++的一个子集。

C is not a subset of C++.

尝试:

foo.c的

int main() {
    int class = 0;
    return 0;
}

反正这里有好玩的:" C ++&QUOT的Ç子集; - >在哪里呢?例子吗?

这篇关于有没有下有效的C code将无法定义g正确编译任何情况下++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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