写在前面:VC++的C编译器,只支持C89,不支持C99和C11。而且微软也不打算在未来的VC++版本中支持C99和C11,他们把更多的精力放在C++上。


以下内容摘自wiki:Visual C++

Microsoft Visual C++ (often abbreviated as MSVC or VC++) is a commercial (free version available), integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages.

VC++是一个支持 C, C++, 和 C++/CLI的IDE(集成开发环境)。
Although the product originated as an IDE for the C programming language, the compiler's support for that language conforms only to the outdated original edition of the C standard, dating from 1989. The later revisions of the standard, C99 and C11, are still not supported at all.[more] According to Herb Sutter, the C compiler is only included for "historical reasons" and is not planned to be further developed.

VC++,尽管开始作为C语言的IDE,但是至今只支持标准C(C89),不支持C99和C11,而且微软也不打算在未来支持。

Users are advised to either use only the subset of the C language that is also valid C++, and then use the C++ compiler to compile their code, or to just use a different compiler such as Intel C++ Compiler or the GNU Compiler Collection instead.

如果你想要尝试一下C99和C11,建议你使用GCC或者ICC等其他编译器。


最后来做个实验吧

标准C规定变量声明必须放在语句块的开头。而C99和C++则没有这条限制。

VC++对C标准的支持

ps:

1.我用的是VC++ 2010, /TP选项指定VC++使用C++编译器编译文件

2.其实标准C也是不支持// 开头的单行注释(你可以在gcc实验这点,"gcc -Wall -ansi -pedantic test.c")。不过VC++的C编译器好像支持。


结束语:VC++的Language Standards Supported by GCC VC++?? 弄得我有一点始终不明白。。。VC++的C编译器到底是像wiki说的只用了C90,还是像某些网站所说的"C90 with a few features for C99"??

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-05-31
  • 2022-02-08
  • 2021-11-19
  • 2022-12-23
猜你喜欢
  • 2021-10-21
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案