0
是疗法的方式使用结构成员的名字最初一个const实例初始常量的typedef的成员名称(MS Visual Studio中)C结构
typedef struct {
int i1;
int i2;
int i3;
} info_t;
//- GCC
const info_t info = {
.i1 = 1,
.i2 = 2
}
//- VS
const info_t info = {1,2,0);
的GCC允许这个方便的方式,但Visual Studio导致错误C2143“Syntax error:missing}”之前。“... GCC还允许省略成员(请参阅示例:info.t3未设置)
有没有人知道简单的方法来生成兼容并很容易阅读VS的解决方法代码?
谢谢。我知道这一点,但有没有解决方法? – Thomas
@Thomas根据http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013 .aspx,在Visual Studio 2013中会有一些对C99的支持,我不知道这个功能是否会成为其中的一个。 –
@YuHao,_Additionally,一些C99核心语言特征将在2013 RTM来实现: * C99 _Bool * C99复合文字 * C99指定的初始 * C99可变declarations_(〔也可参见本]( http://www.infoq.com/resource/news/2013/07/vs2013_CPP_compliance/en/resources/VC_Roadmap.png)) – chris