Inline Functions in C++

By: Prof. Fazal Rehman Shamil

Inline Functions in C++

 

Pros
1. Inline Function speed up your program because it avoids the time waste  due to function calling.
2. Inline Function save time waste due to variables push/pop on the stack, when function calling happens.
3. Inline Function save time of return call from a function.
4. Inline Function increases locality of reference by utilizing instruction cache.
Cons 
1. When we inline the function, it is resolved at compile time. So, we can say that if you change the code of the inline function, then it is necessary to recompile all the program to make sure that it is updated.

Prof. Fazal Rehman Shamil