tmp/tmp5jxno51d/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### The `inline` specifier <a id="dcl.inline">[[dcl.inline]]</a>
|
| 2 |
+
|
| 3 |
+
The `inline` specifier can be applied only to the declaration or
|
| 4 |
+
definition of a variable or function.
|
| 5 |
+
|
| 6 |
+
A function declaration ([[dcl.fct]], [[class.mfct]], [[class.friend]])
|
| 7 |
+
with an `inline` specifier declares an *inline function*. The inline
|
| 8 |
+
specifier indicates to the implementation that inline substitution of
|
| 9 |
+
the function body at the point of call is to be preferred to the usual
|
| 10 |
+
function call mechanism. An implementation is not required to perform
|
| 11 |
+
this inline substitution at the point of call; however, even if this
|
| 12 |
+
inline substitution is omitted, the other rules for inline functions
|
| 13 |
+
specified in this section shall still be respected.
|
| 14 |
+
|
| 15 |
+
A variable declaration with an `inline` specifier declares an *inline
|
| 16 |
+
variable*.
|
| 17 |
+
|
| 18 |
+
A function defined within a class definition is an inline function.
|
| 19 |
+
|
| 20 |
+
The `inline` specifier shall not appear on a block scope
|
| 21 |
+
declaration.[^2] If the `inline` specifier is used in a friend function
|
| 22 |
+
declaration, that declaration shall be a definition or the function
|
| 23 |
+
shall have previously been declared inline.
|
| 24 |
+
|
| 25 |
+
An inline function or variable shall be defined in every translation
|
| 26 |
+
unit in which it is odr-used and shall have exactly the same definition
|
| 27 |
+
in every case ([[basic.def.odr]]).
|
| 28 |
+
|
| 29 |
+
[*Note 1*: A call to the inline function or a use of the inline
|
| 30 |
+
variable may be encountered before its definition appears in the
|
| 31 |
+
translation unit. — *end note*]
|
| 32 |
+
|
| 33 |
+
If the definition of a function or variable appears in a translation
|
| 34 |
+
unit before its first declaration as inline, the program is ill-formed.
|
| 35 |
+
If a function or variable with external linkage is declared inline in
|
| 36 |
+
one translation unit, it shall be declared inline in all translation
|
| 37 |
+
units in which it appears; no diagnostic is required. An inline function
|
| 38 |
+
or variable with external linkage shall have the same address in all
|
| 39 |
+
translation units.
|
| 40 |
+
|
| 41 |
+
[*Note 2*: A `static` local variable in an inline function with
|
| 42 |
+
external linkage always refers to the same object. A type defined within
|
| 43 |
+
the body of an inline function with external linkage is the same type in
|
| 44 |
+
every translation unit. — *end note*]
|
| 45 |
+
|