Function inline expansion eliminates procedure-call overhead and allows general optimization methods to apply across the expanded code. Function inlining has advantages over macros in that arguments are evaluated only once, parentheses need not be overused to avoid problems with precedence, and the actual expansion can be controlled from the command line.
The following pragmas are provided to control function inline expansion:
#pragma inline (function_name [,function_name....]) #pragma noinline (function_name [,function_name....])
If a function is named in an inline
directive, calls
to it are expanded as inline code, if the function has the following
properties:
noinline
directive, calls to it are not expanded as inline code.
inline
or a
noinline
directive, the compiler uses a heuristic to
perform inline expansion of calls where appropriate.
inline
and a noinline
directive.
If the noinline compiler option is used, it overrides all
inline
pragma directives.
Inline functions have the following properties:
varargs
package (allowing a
function to take a variable number of arguments) is not allowed
for inline functions.