gpt4 book ai didi

c++ - 在发出诊断消息时,C++ 标准有哪些保证?

转载 作者:可可西里 更新时间:2023-11-01 18:28:55 25 4
gpt4 key购买 nike

在阅读 C++ 标准时,人们经常会看到诸如“...格式错误,无需诊断”之类的名称。可以在 13.8.1/17 中找到一个(随机)示例:

The class S1::Inner1 is ill-formed, no diagnostic required, because it has no valid specializations.

在标准中哪里可以找到相反的规范语言,它可以对格式错误的程序进行诊断?

最佳答案

您要找的是[intro.compliance]/1

The set of diagnosable rules consists of all syntactic and semantic rules in this document except for those rules containing an explicit notation that “no diagnostic is required” or which are described as resulting in “undefined behavior”.

然后是 [intro.compliance]/2

If a program contains a violation of any diagnosable rule or an occurrence of a construct described in this document as “conditionally-supported” when the implementation does not support that construct, a conforming implementation shall issue at least one diagnostic message.

这保证如果您违反其中一条可诊断规则,您将收到一条诊断消息。

关于c++ - 在发出诊断消息时,C++ 标准有哪些保证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56972120/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com