Visual C++ standards compliance [closed]

南楼画角 提交于 2019-12-03 23:41:21

Perhaps MSDN's Nonstandard Behavior page for Visual C++ will enlighten you? Make sure you look at the version you're most interested in (the box on the right-hand side).

Since MSDN's links change all the time (and who knows why), here's the main content from the page on VS2008, so when the link breaks and someone comes across this answer, they can Google and find the correct page:

Nonstandard Behavior

The following topics are some of the known places where the Visual C++ implementation of C++ does not agree with the C++ standard. The section numbers refer to section numbers in the C++ standard.

My pet peeves, which most programmers find unimportant but which I personally find to hurt readability a lot, is that VC++ is unable to compile the following C++ code:

bool result = true and not false;

… because VC++ doesn’t recognize and, or and not (along with the rest of ISO 646) as valid tokens.

Clarification: The standard mentions the treatment of the above tokens in §2.12, marks them as reserved in §2.11 and defines an equivalence mapping for them in §2.5 to the more conventional operator representations (e.g. and corresponds to &&). It isn’t clear why they get a special status next to the other keywords. Even more confusingly, appendix C2.2 suddenly calls them “keywords”. Still, the standard is absolutely clear about their treatment and semantics. VC simply doesn’t implement these paragraphs (unless you specify the /Za flag during compilation).

Baron

Here's a nice summary in the MSDN blog titled 'C++11 Features in Visual C++ 11' which was updated March 2nd, 2012.

Visual C++ 2k3, 2k5, and 2k8, conform to C89, and C++98.

Some additional features are cherry-picked from C99, and there are a few enhancements on top of C++98.

Standards compliance for C and C++ has been rather poor for VS. Things began changing with 2005 and is getting better. VS2010 is what I am really looking at with quite a lot of features from C++0x. Most of the time though, I end up Googling with the following keywords:

  • msdn ANSI C conformance
  • msdn ISO C++ conformance

etc. when I really really need to figure out why something doesn't work as defined.

I don't use VS 2008 yet, so I can only speak for VS 2005.

It doesn't support C99. Support for C89/90 has always been good in VC and I'm not aware of any non-compliance issues with it.

C++98 support has a number of issues, some of them are documented by MS as known issues and some are plain bugs. I made a blog entry to use as a "notebook" for various VS 2005 C++ bugs I encounter in practice. If you wish, you can take a look here, although this list is probably far from being complete

__try is marked as an extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!