The meaning of the name used in the slogans of the dictionary area

I do not understand the point name used in.... What does it mean? For example (3.4.1 / 7):

The name used in the definition of class X outside the member of the body function ...

Consider the following example:

class A { static const int a = 4; }

int b = A::a;

The name aafter the nested qualifier used in the global scope or used in the scope of class <

The analog namespace address is quite clearly defined in 7.3.1 / 6:

Incoming declaration namespaces are those namespaces in which the declaration lexically appears, with the exception of a member of the namespace outside of its original namespace (for example, the definition as specified in 7.3.1.2).

+4
2

: , .

""?

, , , {}, . T++ PLv4 p157 " ".

[basic.scope.declarative]/1 :

, , , , , .

, , "" .

[basic.scope.declarative]/1 :

, , , , .

. , " " " ", "" , . , [basic.scope.declarative]/3

, , , , [...].

scope , .

"scope"

, , , . . [Stmt.block]/1

.

:

  • X
  • X
  • X

X

: 3.4.3/1

, , -, , , .

class X
{
    int m;
    void foo() { int n; }
};

decltype(X::m) v; // legal
decltype(X::n) w; // illegal

X , - .

X

: 3.3.7/2

:

  • ( ) , ,
  • [...]
class X
{
    int m;
    void foo()
    {
        decltype(m) n;
    }
    static int o;
};
int X::o = decltype(m)();

X , .

, , , / . - , 9.3/5

- f X ; X::f , f X X.

, " " -, / , .

" X" . , 3.3.7/2 , " ", " ".

X

: 8.5/13

-.

class X
{
    static int m;
    static int n;
};

int n;
int o;

int X::m = n; // X::n
int X::n = o; // ::o

( ) " , " [basic.lookup.unqual]/1. X, , (: ), [basic.lookup.unqual]/7.

" X", , - , , X, , ( ..). , - , , .

X

" X".

3.3.3 - 3.3.9 . , : , , . , , - . :

void foo()
{                   // begin scope A
    int a;          // 
    {               // begin scope B
        int b;      // 
        int c;      //
    }               // end scope B
    int d;          //
}                   // end scope A

A B ( ). B A. , - "B A, , B, A". :

class A
{
    int m;
    class B
    {
        int n;
    };
};

" A" B . : .

, - , . , [stmt.block]/1 " ". X , , , (*), , (**), X.

(*) : , .. ( , ) , = ,
(**) : , , , , ,

, , [basic.scope.declarative]/4:

, , [... = ] [... = ].

, , , [basic.scope.declarative]/1:

int main()
{
    int x;
    {
        int x;
    }
}

, . X {}; , ++. , .

, { }.

+1

, X ...

, , , , - (, -, ).

class B : public A
{
   int x;
   int a[i];
   C z;
   //..
};

, : A, x, a, i, C, z.

, x, a z , .

class A { static const int a = 4; }

int b = A::a;

The name a after the nested-name-specifier used into the global scope or it used into the class scope?

A a, , , b.

, , , .

struct A
{
    static int a;
    static int b;
};

int A::a = 10;
int A::b = a;

a . .

0

Source: https://habr.com/ru/post/1545124/


All Articles