• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
小比丘
博客园    首页    新随笔    联系   管理    订阅  订阅
VC++对C标准的支持

写在前面: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++则没有这条限制。

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"??

posted on 2012-07-20 10:40  小比丘  阅读(3233)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3