在VS 2008 C/C++编译器下,是否有可能将以下代码编译为/作为.c文件?
int f(int bounds)
{
int sum = 0;
for( int i = 0; i < bounds ; i++ )
{ .... }
return sum;
}GCC似乎对C语法很满意,但看起来VS'2008更多的期待是这样的:
int f(int bounds)
{
int sum = 0, i;
for( i = 0; i < bounds ; i++ )
{ .... }
return sum;
}发布于 2014-04-15 15:35:11
在VS 2008 C/C++编译器下,是否有可能将以下代码编译为/作为.c文件?
不是的。这是一个C99特性,MSVC不支持C99。必须在i循环之前声明for。
https://stackoverflow.com/questions/23088276
复制相似问题