inline

C compiler only

inline syntax

Read syntax diagramSkip visual syntax diagram#pragmainline( function_name)

Description

The #pragma inline directive specifies that function_name is to be inlined. The pragma can appear anywhere in the source, but must be at file scope. The pragma has no effect if the INLINE(*ON) compiler option parameter is not specified. If #pragma inline is specified for a function, the inliner will force the function specified to be inlined on every call. The function will be inlined in both selective (*NOAUTO) and automatic (*AUTO) INLINE mode.

Inlining replaces function calls with the actual code of the function. It reduces function call overhead, and exposes more code to the optimizer, allowing more opportunities for optimization.

Notes on Usage
  • Inlining takes place only if compiler optimization is set to level 30 or higher.
  • Directly recursive functions will not be inlined. Indirectly recursive functions will be inlined until direct recursion is encountered.
  • Functions calls with variable argument lists will not be inlined if arguments are encountered in the variable portion of the argument list.
  • If a function is called through a function pointer, then inlining will not occur.
  • The pragma inline directive will be ignored if function_name is not defined in the same compilation unit that contains the pragma.
  • A function's definition will be discarded if all of the following are true:
    • The function is static.
    • The function has not had its address taken.
    • The function has been inlined everywhere it is called.
    This action can decrease the size of the module and program object where the function is used.
See "Function Call Performance" in the ILE C/C++ Programmer's Guide for more information about function inlining.