### Inlining

Inlining means that the compiler replaces a function call with the actual code for the function at the point where the call was made. Inlining user code eliminates the overhead of the function call and linkage, and exposes the function's code to the optimizer, resulting in faster code performance. Inlining produces the best results when:

- The overhead for the function is significant; for example, when functions are called within nested loops.
- The inlined function provides additional opportunities for optimization, such as when constant arguments are used.

There are three levels of inlining that can be used with IBM C and C++ Compilers:

Default (no user code inlined)
  By default, the compiler inlines only certain built-in (or intrinsic) library functions.
Inline qualified functions
  Inlines functions qualified with the _Inline or inline keyword. When optimization is turned on (/O+), this setting becomes the default. To turn this level of inlining on, use the /Oi compiler option. The _Inline and inline keywords have the same meaning and syntax as the storage class static.
  Examples

         _Inline int james(int a);

  specifies that you want james to be considered for inlining.

  The _Inline keyword is not supported for use in C++ programs. Instead, use the function specifier inline, in the same manner as _Inline:

         inline int angelique(char c);

  specifies that you want angelique to be considered for inlining.

  When you turn inlining on, C++ member functions that are defined in a class declaration are considered candidates for inlining by the compiler. This is equivalent to declaring them outside of the class declaration and using the inline keyword. For example:

      class X
      {
      	char* a;

      public:

      	char* get_a() {return a:};

      };

Auto-Inlining
  Inlines functions qualified with the _Inline or inline keyword, as well as other functions that are smaller than or the same size as a chosen value in abstract code units (ACUs) as measured by the compiler. In general, choosing the functions you want to inline yields better results than auto-inlining.
  To set this level of inlining, use the /Oivalue compiler option. value has a range between 0 and 65 535 ACUs (abstract code units).
  When you compile, the compiler generates a message for each function it inlines based on the value you specified. Messages are not generated for functions qualified with _Inline or inline, or for C++ functions defined in a class declaration.

Requesting that a function be inlined makes it a candidate for inlining but does not necessarily mean that the function will be inlined. In all cases, the compiler ultimately decides whether a function is inlined.

Tips for Inlining
Restrictions on Inlining
Benefits and Drawbacks of Inlining
Examples for Estimating Abstract Code Units