tmp/tmp7yqrj2go/{from.md → to.md}
RENAMED
|
@@ -1,48 +1,47 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
A function declaration [[dcl.fct]], [[class.mfct]], [[class.friend]]
|
| 7 |
-
with an `inline` specifier declares an *inline function*.
|
| 8 |
-
|
| 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*:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
function. In certain cases, an inline function cannot use names with
|
| 17 |
internal linkage; see [[basic.link]]. — *end note*]
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 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
|
| 35 |
can 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 can be defined in multiple translation units [[basic.def.odr]],
|
| 40 |
-
but is one entity with one address. A type or `static` variable defined
|
| 41 |
-
in the body of such a function is therefore a single
|
| 42 |
-
entity. — *end note*]
|
| 43 |
-
|
| 44 |
If an inline function or variable that is attached to a named module is
|
| 45 |
declared in a definition domain, it shall be defined in that domain.
|
| 46 |
|
| 47 |
[*Note 4*: A constexpr function [[dcl.constexpr]] is implicitly inline.
|
| 48 |
In the global module, a function defined within a class definition is
|
|
|
|
| 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 |
+
function or variable. The `inline` specifier shall not appear on a block
|
| 5 |
+
scope declaration or on the declaration of a function parameter. If the
|
| 6 |
+
`inline` specifier is used in a friend function declaration, that
|
| 7 |
+
declaration shall be a definition or the function shall have previously
|
| 8 |
+
been declared inline.
|
| 9 |
|
| 10 |
A function declaration [[dcl.fct]], [[class.mfct]], [[class.friend]]
|
| 11 |
+
with an `inline` specifier declares an *inline function*. A variable
|
| 12 |
+
declaration with an `inline` specifier declares an *inline variable*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
[*Note 1*: An inline function or variable with external or module
|
| 15 |
+
linkage can be defined in multiple translation units [[basic.def.odr]],
|
| 16 |
+
but is one entity with one address. A type or `static` variable defined
|
| 17 |
+
in the body of such a function is therefore a single
|
| 18 |
+
entity. — *end note*]
|
| 19 |
+
|
| 20 |
+
[*Note 2*: The `inline` keyword has no effect on the linkage of a
|
| 21 |
function. In certain cases, an inline function cannot use names with
|
| 22 |
internal linkage; see [[basic.link]]. — *end note*]
|
| 23 |
|
| 24 |
+
The inline specifier indicates to the implementation that inline
|
| 25 |
+
substitution of the function body at the point of call is to be
|
| 26 |
+
preferred to the usual function call mechanism. An implementation is not
|
| 27 |
+
required to perform this inline substitution at the point of call;
|
| 28 |
+
however, even if this inline substitution is omitted, the other rules
|
| 29 |
+
for inline functions specified in this subclause shall still be
|
| 30 |
+
respected.
|
| 31 |
|
| 32 |
If a definition of a function or variable is reachable at the point of
|
| 33 |
its first declaration as inline, the program is ill-formed. If a
|
| 34 |
function or variable with external or module linkage is declared inline
|
| 35 |
in one definition domain, an inline declaration of it shall be reachable
|
| 36 |
from the end of every definition domain in which it is declared; no
|
| 37 |
diagnostic is required.
|
| 38 |
|
| 39 |
+
[*Note 3*: A call to an inline function or a use of an inline variable
|
| 40 |
can be encountered before its definition becomes reachable in a
|
| 41 |
translation unit. — *end note*]
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
If an inline function or variable that is attached to a named module is
|
| 44 |
declared in a definition domain, it shall be defined in that domain.
|
| 45 |
|
| 46 |
[*Note 4*: A constexpr function [[dcl.constexpr]] is implicitly inline.
|
| 47 |
In the global module, a function defined within a class definition is
|