c++language-lawyerc++17

What is a fully qualified name?


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?

Does this count?

A::f()

or only this?

::A::f()

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


Solution

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

    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)

    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 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.