"full-expression" 对比 "full expression"
"full-expression" versus "full expression"
我正在查看 GitHub 中的 this post,但我无法理解 OP 的意思:
"full expression" suggest that it is a kind of expression, but sometimes it is not.
我的解释是 "full-expression"(标准中使用的术语)可能不是表达式。 [intro.execution]/5给出了full-expression的定义,如下:
A full-expression is
(5.1) — an unevaluated operand (8.2),
(5.2)
— a constant-expression (8.6),
(5.3) — an init-declarator (Clause
11) or a mem-initializer (15.6.2), including the constituent
expressions of the initializer,
(5.4) — an invocation of a
destructor generated at the end of the lifetime of an object other
than a temporary object (15.2), or
(5.5) — an expression that is not
a subexpression of another expression and that is not otherwise part
of a full-expression.
如果我的解释是正确的,我想知道上面的哪个要点产生了一个不是表达式的完整表达式。否则,也就是说,如果我错了,OP 的评论是什么意思?
正式的表达式列表可以在[gram.expr]中找到。这是相当多的文字,所以我不打算在这里包括它,但使用它我们可以看到 init-declarator 和 mem-initializer 不是语法上的表达式。这意味着即使 init-declarator 和 mem-initializer 被认为是完整的表达式,但在语法上它们不是表达式。
我正在查看 GitHub 中的 this post,但我无法理解 OP 的意思:
"full expression" suggest that it is a kind of expression, but sometimes it is not.
我的解释是 "full-expression"(标准中使用的术语)可能不是表达式。 [intro.execution]/5给出了full-expression的定义,如下:
A full-expression is
(5.1) — an unevaluated operand (8.2),
(5.2) — a constant-expression (8.6),
(5.3) — an init-declarator (Clause 11) or a mem-initializer (15.6.2), including the constituent expressions of the initializer,
(5.4) — an invocation of a destructor generated at the end of the lifetime of an object other than a temporary object (15.2), or
(5.5) — an expression that is not a subexpression of another expression and that is not otherwise part of a full-expression.
如果我的解释是正确的,我想知道上面的哪个要点产生了一个不是表达式的完整表达式。否则,也就是说,如果我错了,OP 的评论是什么意思?
正式的表达式列表可以在[gram.expr]中找到。这是相当多的文字,所以我不打算在这里包括它,但使用它我们可以看到 init-declarator 和 mem-initializer 不是语法上的表达式。这意味着即使 init-declarator 和 mem-initializer 被认为是完整的表达式,但在语法上它们不是表达式。