C++ : Inline Functions 2

Situations where the inline function may not work.

* An inline function should be placed before all the functions that call it.

* In the inline function we cannot use loops i.e. we cannot use for loop, while loop, and do-while loop

* In inline functions switch statements cannot be used.

* An inline function cannot return any value.

* Return statement cannot be used in an inline function.

* It should not contain static variables.

* Function should not be recursive.


* If the definition of the function is given inside the definition of the class then it automatically becomes inline.

* Function should be made inline if it is small and used at less number of places.

* Making a function inline is a request to the system to perform function body substitution, if the system feels correct it performs function body substitution otherwise it performs function call implementation.