在C ++标准中未定义行为段落中的[注]是什么意思? [英] What does the [Note] in undefined behavior paragraph in C++ standard mean?

查看:174
本文介绍了在C ++标准中未定义行为段落中的[注]是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户Tony 指出在C ++标准的1.3.12段中有一个[Note]

As user Tony points out there's a [Note] in paragraph 1.3.12 of C++ standard saying


允许未定义的行为范围包括完全忽略具有不可预测的结果的情况,在以文档化的方式表现环境特征的翻译或程序执行期间行为...

permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment...

这不符合UB的定义,表示 没有要求 ?我的意思是他们说没有要求,然后说允许的UB - 在同一段落。

Doesn't this contradict the definition of UB saying that ...this International Standard imposes no requirements? I mean they say "no requirements" and then say "permissible UB" - right in the same paragraph.

如何解释这个说明?是否确实以任何方式限制UB?

How should this note be interpreted? Does it indeed limit UB in any way?

推荐答案

第3部分 ISO / IEC指令:

From §6.5.1 of Part 3 of the ISO/IEC Directives:


标准的
文本中的注释和示例只能用于
用于提供附加信息
用于帮助理解
或使用标准,不得使用
包含符合
条件的条款,以便符合
能够声明符合
标准。

Notes and examples integrated in the text of a standard shall only be used for giving additional information intended to assist the understanding or use of the standard and shall not contain provisions to which it is necessary to conform in order to be able to claim compliance with the standard.

因此,这是完全非规范的(非约束性的),仅用于可能的澄清。

So it's entirely non-normative (non-binding) and meant only for possible clarification.

这篇关于在C ++标准中未定义行为段落中的[注]是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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