C11 6.7.4 p6:
A function declared with an inline function specifier is an inline
function.
and:
6.7.4 p7:
Any function with internal linkage can be an inline function. For a
function with external linkage, the following restrictions apply: If a
function is declared with an inline function specifier, then it shall
also be defined in the same translation unit. If all of the file scope
declarations for a function in a translation unit include the inline
function specifier without extern, then the definition in that
translation unit is an inline definition.
Then, if a function is an inline function but there is no inline definition of it in the current translation unit. For example, extern inline int foo(){...}
, For foo();
, is it still possible for it to be inlined rather than being a call?(extern inline int foo(){...}
does not meet the requirements for an inline definition. It creates an external definition. foo
is an inline function, but the definition of the function is not an inline definition.)
In other words, does the chance of a function being inlined depend on whether the function is an inline function or on whether the function has an inline definition?
1