An inline function can be written in C99 or C++ like this:
inline int max(int a, int b){ return (a > b) ? a : b;}
Then, a statement such as the following:
a = max(x, y);
may be transformed into a more direct computation:
a = (x > y) ? x : y;
We will see how these functions are optimized with flags :
-O2
-finline-small-functions : Integrate functions into their callers when their body is smaller than expected function call code (so overall size of program gets smaller). The compiler heuristically decides which functions are simple enough to be worth integrating in this way. This inlining applies to all functions, even those not declared inline.
-O3
-finline-functions: Consider all functions for inlining, even if they are not declared inline. The compiler heuristically decides which functions are worth integrating in this way.
If all calls to a given function are integrated, and the function is declared static, then the function is normally not output as assembler code in its own right.