Visual C++标准合规性

发布于 2024-08-08 15:36:06 字数 325 浏览 6 评论 0原文

我想知道 Microsoft 的 Visual C++ 编译器是否以及在何种程度上符合当前的 C (C90/C99) 和 C++ (ISO/IEC 14882:2003) 标准。不幸的是,我只能找到有关该主题的部分信息,我可能看错了所有地方。

非常感谢任何指向相关资源的指针。提前致谢。

编辑: 由于看起来这是一个最敏感的话题,所以我会满足于 MSVC 是否完全符合 C90 的是/否答案......我已经了解到 C99 的情况并非如此(自然) ,我仍然对 C++ 一无所知。Edit2

: 感谢大家的回答。我接受了鲁沙科夫先生的回答,但对所有相关答案都投了赞成票,这些答案都很有帮助。

I was wondering if, and to what degree, does Microsoft's Visual C++ compiler conform to the current C (C90/C99) and C++ (ISO/IEC 14882:2003) standards. Unfortunately I'm only able to find partial information on the subject, I may be looking at all the wrong places.

Any pointers to related resources are much appreciated. Thanks in advance.

Edit:
Since is looks like this is a most touchy subject, I'd be content with a yes/no answer on whether MSVC wholly conforms to C90...I've come to the understanding that this is not the case for C99 (naturally), and I still have no clue about C++..

Edit2:
Thanks to everyone for their answers. I've accepted Mr. Rushakov's answer but upvoted all relevant answers, which were all helpful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

多彩岁月 2024-08-15 15:36:06

也许 Visual C++ 的 MSDN 的非标准行为页面会有所启发你?确保查看您最感兴趣的版本(右侧的框)。

由于 MSDN 的链接一直在变化(谁知道为什么),这里是 VS2008 页面的主要内容,因此当链接中断并且有人遇到这个答案时,他们可以 Google 并找到正确的页面:

非标准行为

以下主题是其中的一些
Visual C++ 的已知地方
C++的实现不同意
与 C++ 标准。该部分
数字指的是节号
C++ 标准。

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.

愁以何悠 2024-08-15 15:36:06

我最讨厌的是 VC++ 无法编译以下 C++ 代码:

bool result = true and not false;

…因为 VC++ 无法识别 ornot(以及 ISO 646 的其余部分)作为有效标记。

说明:该标准在 §2.12 中提到了对上述标记的处理,在 §2.11 中将它们标记为保留,并在 §2.5 中定义了它们到更传统的运算符表示的等价映射(例如 对应于 &&)。目前尚不清楚为什么它们会获得与其他关键字并列的特殊地位。更令人困惑的是,附录 C2.2 突然称它们为“关键字”。尽管如此,该标准对于它们的处理和语义是绝对清楚的。 VC 根本不实现这些段落(除非您在编译期间指定 /Za 标志)。

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).

说不完的你爱 2024-08-15 15:36:06

MSDN 博客 中有一个很好的摘要,标题为“Visual C++ 11 中的 C++11 功能”,更新于 2012 年 3 月 2 日。

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

赏烟花じ飞满天 2024-08-15 15:36:06

Visual C++ 2k3、2k5 和 2k8,符合 C89 和 C++98。

一些附加功能是从 C99 中精心挑选的,并且在 C++98 之上还有一些增强功能。

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.

楠木可依 2024-08-15 15:36:06

VS 对 C 和 C++ 标准的遵从性相当差。 2005 年情况开始发生变化,并且正在好转。 VS2010 是我真正关注的,它具有 C++0x 的很多功能。但大多数时候,

  • 我最终会使用以下关键字进行谷歌搜索: msdn ANSI C 一致性
  • msdn ISO C++ 一致性等。

当我确实需要弄清楚为什么某些东西不能按定义工作时,

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.

清晰传感 2024-08-15 15:36:06

我还没有使用VS 2008,所以我只能说VS 2005。

它不支持C99。 VC 对 C89/90 的支持一直很好,我不知道有任何不合规的问题。

C++98 支持存在许多问题,其中一些被 MS 记录为已知问题,另一些则是普通的错误。我写了一篇博客文章作为我在实践中遇到的各种 VS 2005 C++ bug 的“笔记本”。如果您愿意,可以查看此处,尽管这个列表可能远未完成

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

眼眸印温柔 2024-08-15 15:36:06

__try 被标记为扩展

__try is marked as an extension

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文