什么是标准名称? [英] What is a fully qualified name?

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

问题描述

据我所知,标准中未提及完全合格一词(

As far as I can tell, the term fully qualified isn't mentioned in the standard (e.g.), but I can recall "hearing" it many times online.

人们说一个名字完全合格是什么意思?

What do people mean when they say a name is fully qualified?

这算吗?

A::f()

还是只有这个?

::A::f()

而且,如果它是 标准,我找不到哪个措辞?

And, if it is standard, which wording have I not found?

推荐答案

使用范围解析运算符的标识符是根据[expr.prim.id.qual]的限定名称.否则不合格.

An identifier that uses the scope resolution operator is a qualified name as per [expr.prim.id.qual]. Otherwise it is unqualified.

该标准并未定义完全合格的含义,但确实在[library]/[requirements]/[organization]/[contents]中提及了该标准上面写着(引自标准草案)

The standard doesn't define the meaning of fully qualified, but it does mention it in [library]/[requirements]/[organization]/[contents] which says (quote from standard draft)

每当提及标准库中定义的名称x时,除非另有明确说明,否则假定名称x完全限定为:: std :: x. 例如,如果将库函数F的Effects:元素描述为调用库函数G,则意味着:: std :: G函数.

Whenever a name x defined in the standard library is mentioned, the name x is assumed to be fully qualified as ::std::x, unless explicitly described otherwise. For example, if the Effects: element for library function F is described as calling library function G, the function ::std::G is meant.

Wikipedia定义完全限定的名称:

Wikipedia defines Fully qualified name:

在计算机编程中,完全限定名称是一个明确的名称,它指定调用所引用的对象,函数或变量,而与调用的上下文无关.

In computer programming, a fully qualified name is an unambiguous name that specifies which object, function, or variable a call refers to without regard to the context of the call

只有从全局名称空间开始限定的名称是没有上下文的.这是常见用法.

Only a name qualified starting from the global namespace is unambiguous without context. This is the common usage.

这篇关于什么是标准名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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