From Jason Turner

[dcl.link]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4em5mgc5/{from.md → to.md} +18 -12
tmp/tmp4em5mgc5/{from.md → to.md} RENAMED
@@ -18,24 +18,29 @@ identical.
18
  Linkage [[basic.link]] between C++ and non-C++ code fragments can be
19
  achieved using a *linkage-specification*:
20
 
21
  ``` bnf
22
  linkage-specification:
23
- extern string-literal '{' declaration-seqₒₚₜ '}'
24
- extern string-literal name-declaration
25
  ```
26
 
27
- The *string-literal* indicates the required language linkage. This
28
- document specifies the semantics for the *string-literal*s `"C"` and
29
- `"C++"`. Use of a *string-literal* other than `"C"` or `"C++"` is
30
- conditionally-supported, with *implementation-defined* semantics.
31
 
32
- [*Note 2*: Therefore, a linkage-specification with a *string-literal*
 
 
 
 
 
 
 
 
33
  that is unknown to the implementation requires a
34
  diagnostic. — *end note*]
35
 
36
- *Recommended practice:* The spelling of the *string-literal* should be
37
  taken from the document defining that language. For example, `Ada` (not
38
  `ADA`) and `Fortran` or `FORTRAN`, depending on the vintage.
39
 
40
  Every implementation shall provide for linkage to the C programming
41
  language, `"C"`, and C++, `"C++"`.
@@ -56,11 +61,11 @@ other than C++ language linkage is conditionally-supported with
56
  *implementation-defined* semantics.
57
 
58
  Linkage specifications nest. When linkage specifications nest, the
59
  innermost one determines the language linkage.
60
 
61
- [*Note 3*: A linkage specification does not establish a
62
  scope. — *end note*]
63
 
64
  A *linkage-specification* shall inhabit a namespace scope. In a
65
  *linkage-specification*, the specified language linkage applies to the
66
  function types of all function declarators and to all functions and
@@ -167,11 +172,12 @@ extern "C" int h() { return 97; } // definition for the function h with C lang
167
  — *end example*]
168
 
169
  A declaration directly contained in a *linkage-specification* is treated
170
  as if it contains the `extern` specifier [[dcl.stc]] for the purpose of
171
  determining the linkage of the declared name and whether it is a
172
- definition. Such a declaration shall not specify a storage class.
 
173
 
174
  [*Example 5*:
175
 
176
  ``` cpp
177
  extern "C" double f();
@@ -183,15 +189,15 @@ extern "C" {
183
  extern "C" static void g(); // error
184
  ```
185
 
186
  — *end example*]
187
 
188
- [*Note 4*: Because the language linkage is part of a function type,
189
  when indirecting through a pointer to C function, the function to which
190
  the resulting lvalue refers is considered a C function. — *end note*]
191
 
192
- Linkage from C++ to objects defined in other languages and to objects
193
  defined in C++ from other languages is *implementation-defined* and
194
  language-dependent. Only where the object layout strategies of two
195
  language implementations are similar enough can such linkage be
196
  achieved.
197
 
 
18
  Linkage [[basic.link]] between C++ and non-C++ code fragments can be
19
  achieved using a *linkage-specification*:
20
 
21
  ``` bnf
22
  linkage-specification:
23
+ extern unevaluated-string '{' declaration-seqₒₚₜ '}'
24
+ extern unevaluated-string name-declaration
25
  ```
26
 
27
+ The *unevaluated-string* indicates the required language linkage.
 
 
 
28
 
29
+ [*Note 2*: Escape sequences and *universal-character-name*s have been
30
+ replaced [[lex.string.uneval]]. — *end note*]
31
+
32
+ This document specifies the semantics for the *unevaluated-string*s
33
+ `"C"` and `"C++"`. Use of an *unevaluated-string* other than `"C"` or
34
+ `"C++"` is conditionally-supported, with *implementation-defined*
35
+ semantics.
36
+
37
+ [*Note 3*: Therefore, a *linkage-specification* with a language linkage
38
  that is unknown to the implementation requires a
39
  diagnostic. — *end note*]
40
 
41
+ *Recommended practice:* The spelling of the language linkage should be
42
  taken from the document defining that language. For example, `Ada` (not
43
  `ADA`) and `Fortran` or `FORTRAN`, depending on the vintage.
44
 
45
  Every implementation shall provide for linkage to the C programming
46
  language, `"C"`, and C++, `"C++"`.
 
61
  *implementation-defined* semantics.
62
 
63
  Linkage specifications nest. When linkage specifications nest, the
64
  innermost one determines the language linkage.
65
 
66
+ [*Note 4*: A linkage specification does not establish a
67
  scope. — *end note*]
68
 
69
  A *linkage-specification* shall inhabit a namespace scope. In a
70
  *linkage-specification*, the specified language linkage applies to the
71
  function types of all function declarators and to all functions and
 
172
  — *end example*]
173
 
174
  A declaration directly contained in a *linkage-specification* is treated
175
  as if it contains the `extern` specifier [[dcl.stc]] for the purpose of
176
  determining the linkage of the declared name and whether it is a
177
+ definition. Such a declaration shall not have a
178
+ *storage-class-specifier*.
179
 
180
  [*Example 5*:
181
 
182
  ``` cpp
183
  extern "C" double f();
 
189
  extern "C" static void g(); // error
190
  ```
191
 
192
  — *end example*]
193
 
194
+ [*Note 5*: Because the language linkage is part of a function type,
195
  when indirecting through a pointer to C function, the function to which
196
  the resulting lvalue refers is considered a C function. — *end note*]
197
 
198
+ Linkage from C++ to entities defined in other languages and to entities
199
  defined in C++ from other languages is *implementation-defined* and
200
  language-dependent. Only where the object layout strategies of two
201
  language implementations are similar enough can such linkage be
202
  achieved.
203