“不需要诊断"的理由是什么? [英] What is the rationale to "no diagnostic required"?

查看:154
本文介绍了“不需要诊断"的理由是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数人都熟悉C ++中的未定义"和未指定"行为说明,但是不需要诊断"又如何呢?

Most people are familiar with the "undefined" and "unspecified" behaviour notes in C++, but what about "no diagnostic required"?

我注意到此问题和答案,涉及格式不正确的程序,但是关于否诊断要求"语句.

I note this question and answer, dealing with ill formed programs, but not much detail on the root of "no diagnostic required" statements.

委员会将某些东西分类为无需诊断"时采用的一般方法是什么?

What is the general approach applied by the committee when classifying something as "no diagnostic required"?

  • 标准委员会将错误指定为错误的程度有多严重?
  • 这些错误是否具有几乎无法检测到并因此无法诊断的性质?

未定义"和未指定"行为的例子并非供不应求.除了ODR,还有哪些实际示例可以解决无需诊断"类型的错误?

Examples of "undefined" and "unspecified" behaviour are not in short supply; short of the ODR, what practical example(s) are there for the "no diagnostic required" type errors?

推荐答案

此处进行了讨论:

There was a discussion here: https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/lk1qAvCiviY with utterances by various committee members.

总体共识似乎是

  • 没有规范上的差异
  • 格式错误;不需要诊断仅用于违反编译时规则,绝不用于违反运行时规则.
  • there is no normative difference
  • ill-formed; no diagnostic required is used only for compile-time rule violations, never for runtime rule violations.

正如我在那个话题中所说的,我曾经在一次讨论中听到(我已经不记得其中的哪个了,但是我确定其中有一些有见识的委员会成员)

As I said in that thread, I did once hear in a discussion (I can't remember anymore in which one, but I'm certain there were insightful committee members involved)

  • 格式错误;对于明显违反规则且原则上可以在编译时进行诊断的情况,则无需进行诊断,但是在实施过程中将需要付出巨大的努力.
  • 未定义行为,用于实现可能会找到有用含义的事物,因此不一定非得是纯粹的邪恶,以及任何导致任意后果的运行时违规.
  • ill-formed; no diagnostic required for cases that clearly are bad rule violations and that can in principle be diagnosed at compile time, but would require huge efforts from an implementation.
  • undefined behavior for things that implementations could find useful meanings for, so don't neccessarily are pure evil, and for any runtime violations that results in arbitrary consequences.

对我来说,粗略的指导是:如果是在编译时,它往往是格式错误;不需要诊断";如果是在运行时,它总是未定义行为".

The rough guide for me is; if it is at compile time, it tends to be "ill-formed; no diagnostic required" and if it is at runtime, it always is "undefined behavior".

这篇关于“不需要诊断"的理由是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆