Visual Studio 是否支持新的 C/C++ 标准?

2021-12-07 00:00:00 visual-studio visual-c++ c++ c++11 c99

我一直在阅读有关 C99 和 C++11 以及所有这些正在添加到语言标准中的非常棒的东西,这些东西有一天可能会很好用.然而,我们目前在 Visual Studio 中编写 C++ 的土地上苦苦挣扎.

I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio.

标准中的任何新内容是否会被添加到 Visual Studio 中,或者微软是否对添加新的 C# 变体更感兴趣?

Will any of the new stuff in the standard ever get added to visual studio, or is Microsoft more interested in adding new C# variants to do that?

除了已接受的答案,我还找到了 Visual C++ 团队博客:

In addition to the accepted answer, I found the Visual C++ team blog:

http://blogs.msdn.com/vcblog/

特别是其中的这篇文章:

And specifically, this post in it:

https://web.archive.org/web/20190109064523/https://blogs.msdn.microsoft.com/vcblog/2008/02/22/tr1-slide-decks/

非常有用.谢谢!

推荐答案

MS 对此有一系列公开回复,其中大多数都指责他们的用户.喜欢这个:

MS has a series of public replies to this, most of them blaming their users. Like this one:

https://devblogs.microsoft.com/cppblog/iso-c-标准更新/

现在,Visual C++ 编译器团队偶尔会收到关于为什么我们没有实现 C99 的问题.这实际上是基于我们用户的兴趣.当我们收到许多对某些 C99 功能的请求时,我们已经尝试实现它们(或类似物).几个例子是可变参数宏、long long__pragma__FUNCTION____restrict.如果您发现其他 C99 功能对您的工作有用,请告诉我们!我们的 C 用户很少听到我们的声音,所以说出来,让自己听到

Now, the Visual C++ compiler team receives the occasionally question as to why we haven’t implemented C99. It’s really based on interest from our users. Where we’ve received many requests for certain C99 features, we’ve tried to implement them (or analogues). A couple examples are variadic macros, long long, __pragma, __FUNCTION__, and __restrict. If there are other C99 features that you’d find useful in your work, let us know! We don’t hear much from our C users, so speak up and make yourselves heard

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=345360

嗨:不幸的是,我们从大多数用户那里得到的压倒性反馈是,他们更愿意我们专注于 C++-0x 而不是 C-99.我们有樱桃采摘"某些流行的 C-99 特性(可变参数宏,long long),但除此之外,我们不太可能在 C-99 领域做更多的事情(至少在短期内).

Hi: unfortunately the overwhelming feadback we get from the majority of our users is that they would prefer that we focus on C++-0x instead of on C-99. We have "cherry-picked" certain popular C-99 features (variadic macros, long long) but beyond this we are unlikely to do much more in the C-99 space (at least in the short-term).

乔纳森洞穴

Visual C++ 编译器团队.

Visual C++ Compiler Team.

这是一个非常可悲的状态,但如果您怀疑 MS 想要锁定用户,这也是有道理的:这使得将现代基于 gcc 的代码移植到 MSVC 中变得非常困难,至少我觉得这非常痛苦.

This is a pretty sad state of affairs, but also makes sense if you suspect MS wants to lock users in: it makes it very hard to port modern gcc-based code into MSVC, which at least I find extremely painful.

不过,存在一种解决方法:请注意,英特尔在这方面更加开明.英特尔 C 编译器可以处理 C99 代码,甚至具有与 gcc 相同的标志,从而更容易在平台之间移植代码.此外,英特尔编译器在 Visual Studio 中工作.因此,通过废弃 MS 编译器,您仍然可以使用您认为具有某种价值的 MS IDE,并尽情使用 C99.

A workaround exists, though: Note that Intel is much more enlightened on this. the Intel C compiler can handle C99 code and even has the same flags as gcc, making it much easier to port code between platforms. Also, the Intel compiler works in visual studio. So by scrapping MS COMPILER you can still use the MS IDE that you seem to think has some kind of value, and use C99 to your hearts content.

老实说,更明智的方法是转移到 Intel CC 或 gcc,并在您的编程环境中使用 Eclipse.根据我的经验,代码在 Windows-Linux-Solaris-AIX 等之间的可移植性通常很重要,不幸的是,MS 工具根本不支持这一点.

A more sensible approach is honestly to move over to Intel CC or gcc, and use Eclipse for your programming environment. Portability of code across Windows-Linux-Solaris-AIX-etc is usually important in my experience, and that is not at all supported by MS tools, unfortunately.

相关文章