From Jason Turner

[basic.scope.namespace]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9o_temqy/{from.md → to.md} +16 -16
tmp/tmp9o_temqy/{from.md → to.md} RENAMED
@@ -1,32 +1,30 @@
1
  ### Namespace scope <a id="basic.scope.namespace">[[basic.scope.namespace]]</a>
2
 
3
  The declarative region of a *namespace-definition* is its
4
- *namespace-body*. The potential scope denoted by an
5
- *original-namespace-name* is the concatenation of the declarative
6
- regions established by each of the *namespace-definition*s in the same
7
- declarative region with that *original-namespace-name*. Entities
8
- declared in a *namespace-body* are said to be *members* of the
9
- namespace, and names introduced by these declarations into the
10
- declarative region of the namespace are said to be *member names* of the
11
- namespace. A namespace member name has namespace scope. Its potential
12
- scope includes its namespace from the name’s point of declaration (
13
- [[basic.scope.pdecl]]) onwards; and for each *using-directive* (
14
- [[namespace.udir]]) that nominates the member’s namespace, the member’s
15
- potential scope includes that portion of the potential scope of the
16
- *using-directive* that follows the member’s point of declaration.
17
 
18
  ``` cpp
19
  namespace N {
20
  int i;
21
  int g(int a) { return a; }
22
  int j();
23
  void q();
24
  }
25
  namespace { int l=1; }
26
- // the potential scope of l is from its point of declaration
27
- // to the end of the translation unit
28
 
29
  namespace N {
30
  int g(char a) { // overloads N::g(int)
31
  return l+a; // l is from unnamed namespace
32
  }
@@ -39,14 +37,16 @@ namespace N {
39
  }
40
  int q(); // error: different return type
41
  }
42
  ```
43
 
 
 
44
  A namespace member can also be referred to after the `::` scope
45
  resolution operator ([[expr.prim]]) applied to the name of its
46
  namespace or the name of a namespace which nominates the member’s
47
- namespace in a *using-directive;* see  [[namespace.qual]].
48
 
49
  The outermost declarative region of a translation unit is also a
50
  namespace, called the *global namespace*. A name declared in the global
51
  namespace has *global namespace scope* (also called *global scope*). The
52
  potential scope of such a name begins at its point of declaration (
 
1
  ### Namespace scope <a id="basic.scope.namespace">[[basic.scope.namespace]]</a>
2
 
3
  The declarative region of a *namespace-definition* is its
4
+ *namespace-body*. Entities declared in a *namespace-body* are said to be
5
+ *members* of the namespace, and names introduced by these declarations
6
+ into the declarative region of the namespace are said to be *member
7
+ names* of the namespace. A namespace member name has namespace scope.
8
+ Its potential scope includes its namespace from the name’s point of
9
+ declaration ([[basic.scope.pdecl]]) onwards; and for each
10
+ *using-directive* ([[namespace.udir]]) that nominates the member’s
11
+ namespace, the member’s potential scope includes that portion of the
12
+ potential scope of the *using-directive* that follows the member’s point
13
+ of declaration.
14
+
15
+ [*Example 1*:
 
16
 
17
  ``` cpp
18
  namespace N {
19
  int i;
20
  int g(int a) { return a; }
21
  int j();
22
  void q();
23
  }
24
  namespace { int l=1; }
25
+ // the potential scope of l is from its point of declaration to the end of the translation unit
 
26
 
27
  namespace N {
28
  int g(char a) { // overloads N::g(int)
29
  return l+a; // l is from unnamed namespace
30
  }
 
37
  }
38
  int q(); // error: different return type
39
  }
40
  ```
41
 
42
+ — *end example*]
43
+
44
  A namespace member can also be referred to after the `::` scope
45
  resolution operator ([[expr.prim]]) applied to the name of its
46
  namespace or the name of a namespace which nominates the member’s
47
+ namespace in a *using-directive*; see  [[namespace.qual]].
48
 
49
  The outermost declarative region of a translation unit is also a
50
  namespace, called the *global namespace*. A name declared in the global
51
  namespace has *global namespace scope* (also called *global scope*). The
52
  potential scope of such a name begins at its point of declaration (