Nominate Inline Functions

Inlining is a C and C++ feature that you can exploit to improve the performance of your code. To reduce the overhead of function calls, you can request that the code for some functions be inserted inline, in place of the call statement, and that no actual call occurs.

You cannot specify exactly which function calls are replaced with inlined copies of functions, but you can make suggestions that compiler may act upon. For functions in the VisualAge C++ run-time library, you have limited control. For functions that you supply, you have greater flexibility.

Inlining Library Functions
In the VisualAge C++ runtime library, intrinsic functions are the functions that may be inlined. Some intrinsic functions belong to the set of built-in functions that are declared in <builtin.h>. You cannot turn off inlining for the built-in functions because they have no bodies in the runtime library. The compiler must generate the code for them. For other intrinsic functions, the compiler can either insert the code for the function inline or create a call to the function in the runtime library.

Some functions are inlined only when you build your module with optimization on. To inline these functions build with opt(level, level) when level has a non-zero value.

When optimization is on, the intrinsic functions are not inlined in the following circumstances:

(strcpy) (str1, str2);

Inlining User Code
You can also request that the compiler inline the code for your own functions.

A C function is a candidate for inlining if it meets one of the following criteria.

A C++ function is a candidate for inlining if it meets one of the following criteria.

Function calls cannot be inlined if they meet one of the following criteria:

To enable inlining of candidate functions qualified with inline or _Inline, you must build with opt(inline) and turn on optimization by building with opt(level, level) when level has a non-zero value.

To enable automatic inlining of candidate C and C++ functions, build with opt(autoInline, yes) and turn on optimization by building with opt(level, level) where level has a non-zero value.
Use opt(autoInlineThreshold, number) to control the amount of inlining that will occur.

You cannot completely control what functions are inlined. In all cases, the compiler ultimately decides, based on internal algorithms.



Incremental C++ Build
C Compilation
Configuration Files
Optimize your Program
Inlining


Set Build Options
Build


Optimization Options
Optimization Options