tmp/tmpvonz_k8j/{from.md → to.md}
RENAMED
|
@@ -1,19 +1,23 @@
|
|
| 1 |
#### Unnamed namespaces <a id="namespace.unnamed">[[namespace.unnamed]]</a>
|
| 2 |
|
| 3 |
An *unnamed-namespace-definition* behaves as if it were replaced by
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
-
'inline'ₒₚₜ 'namespace' unique '{ /* empty body */ }'
|
| 7 |
-
'using namespace' unique ';'
|
| 8 |
-
'namespace' unique '{' namespace-body '}'
|
| 9 |
```
|
| 10 |
|
| 11 |
where `inline` appears if and only if it appears in the
|
| 12 |
-
*unnamed-namespace-definition*
|
| 13 |
translation unit are replaced by the same identifier, and this
|
| 14 |
-
identifier differs from all other identifiers in the
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
namespace { int i; } // unique ::i
|
| 18 |
void f() { i++; } // unique ::i++
|
| 19 |
|
|
@@ -31,5 +35,7 @@ void h() {
|
|
| 31 |
A::i++; // A::unique ::i
|
| 32 |
j++; // A::unique ::j
|
| 33 |
}
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
|
|
| 1 |
#### Unnamed namespaces <a id="namespace.unnamed">[[namespace.unnamed]]</a>
|
| 2 |
|
| 3 |
An *unnamed-namespace-definition* behaves as if it were replaced by
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
+
'inline'ₒₚₜ 'namespace' 'unique ' '{ /* empty body */ }'
|
| 7 |
+
'using namespace' 'unique ' ';'
|
| 8 |
+
'namespace' 'unique ' '{' namespace-body '}'
|
| 9 |
```
|
| 10 |
|
| 11 |
where `inline` appears if and only if it appears in the
|
| 12 |
+
*unnamed-namespace-definition* and all occurrences of `unique ` in a
|
| 13 |
translation unit are replaced by the same identifier, and this
|
| 14 |
+
identifier differs from all other identifiers in the translation unit.
|
| 15 |
+
The optional *attribute-specifier-seq* in the
|
| 16 |
+
*unnamed-namespace-definition* appertains to `unique `.
|
| 17 |
+
|
| 18 |
+
[*Example 1*:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace { int i; } // unique ::i
|
| 22 |
void f() { i++; } // unique ::i++
|
| 23 |
|
|
|
|
| 35 |
A::i++; // A::unique ::i
|
| 36 |
j++; // A::unique ::j
|
| 37 |
}
|
| 38 |
```
|
| 39 |
|
| 40 |
+
— *end example*]
|
| 41 |
+
|