Using inline functions

An inline function is expanded in any context in which it is called. This avoids the normal performance overhead associated with the branching for a function call, and it allows functions to be included in basic blocks. The XL C/C++ and Fortran compilers provide several options for inlining.

The following options instruct the compiler to automatically inline all functions it deems appropriate:

The following options allow you to select or name functions to be inlined:

In C/C++, you can also use the standard inline function specifier or the __attribute__(always_inline) extension in your code to mark a function for inlining.

Important!:
Do not overuse inlining because there are limits on how much inlining will be done. Mark only the most important functions.

For more information about the various compiler options for controlling function inlining, see the XL Fortran Optimization and Programming and XL C/C++ Programming Guide. For information on the different variations of the inline keyword supported by XL C/ C++, as well as the inlining function attribute extensions, see the XL C/C++ Language Reference .