tmp/tmph8hk6zf8/{from.md → to.md}
RENAMED
|
@@ -1,45 +1,51 @@
|
|
| 1 |
### The `inline` specifier <a id="dcl.inline">[[dcl.inline]]</a>
|
| 2 |
|
| 3 |
-
The `inline` specifier
|
| 4 |
-
|
| 5 |
|
| 6 |
-
A function declaration ([[dcl.fct]],
|
| 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
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
A
|
|
|
|
| 19 |
|
| 20 |
-
The `inline` specifier shall not appear on a block scope
|
| 21 |
-
declaration.
|
| 22 |
-
declaration, that declaration shall be a
|
| 23 |
-
shall have previously been declared inline.
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
[*Note
|
| 30 |
-
|
| 31 |
translation unit. — *end note*]
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
| 45 |
|
|
|
|
| 1 |
### The `inline` specifier <a id="dcl.inline">[[dcl.inline]]</a>
|
| 2 |
|
| 3 |
+
The `inline` specifier shall be applied only to the declaration of a
|
| 4 |
+
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 subclause shall still be respected.
|
| 14 |
|
| 15 |
+
[*Note 1*: The `inline` keyword has no effect on the linkage of a
|
| 16 |
+
function. In certain cases, an inline function cannot use names with
|
| 17 |
+
internal linkage; see [[basic.link]]. — *end note*]
|
| 18 |
|
| 19 |
+
A variable declaration with an `inline` specifier declares an
|
| 20 |
+
*inline variable*.
|
| 21 |
|
| 22 |
+
The `inline` specifier shall not appear on a block scope declaration or
|
| 23 |
+
on the declaration of a function parameter. If the `inline` specifier is
|
| 24 |
+
used in a friend function declaration, that declaration shall be a
|
| 25 |
+
definition or the function shall have previously been declared inline.
|
| 26 |
|
| 27 |
+
If a definition of a function or variable is reachable at the point of
|
| 28 |
+
its first declaration as inline, the program is ill-formed. If a
|
| 29 |
+
function or variable with external or module linkage is declared inline
|
| 30 |
+
in one definition domain, an inline declaration of it shall be reachable
|
| 31 |
+
from the end of every definition domain in which it is declared; no
|
| 32 |
+
diagnostic is required.
|
| 33 |
|
| 34 |
+
[*Note 2*: A call to an inline function or a use of an inline variable
|
| 35 |
+
may be encountered before its definition becomes reachable in a
|
| 36 |
translation unit. — *end note*]
|
| 37 |
|
| 38 |
+
[*Note 3*: An inline function or variable with external or module
|
| 39 |
+
linkage has the same address in all translation units. A `static` local
|
| 40 |
+
variable in an inline function with external or module linkage always
|
| 41 |
+
refers to the same object. A type defined within the body of an inline
|
| 42 |
+
function with external or module linkage is the same type in every
|
| 43 |
+
translation unit. — *end note*]
|
| 44 |
+
|
| 45 |
+
If an inline function or variable that is attached to a named module is
|
| 46 |
+
declared in a definition domain, it shall be defined in that domain.
|
| 47 |
+
|
| 48 |
+
[*Note 4*: A constexpr function [[dcl.constexpr]] is implicitly inline.
|
| 49 |
+
In the global module, a function defined within a class definition is
|
| 50 |
+
implicitly inline ([[class.mfct]], [[class.friend]]). — *end note*]
|
| 51 |
|