Inline functions advantages

What is the inline function and what is the use of inline function?

Questions by arjunk

Showing Answers 1 - 6 of 6 Answers

Amit

  • Jan 6th, 2012
 

Inline function: they are same as Normal function but compiler treat them diffrently. When we call a inline function compiler will replace the call by inline function body (It depends upon how you have made a call).
we can make a request to compiler to treat a function as inline, it up to the compiler whether it use as inline or not.

Advantage: If your inline function is small then, function call overhead can be avoided , so by using inline you can get some better performance.


  Was this answer useful?  Yes

Paul_Singh

  • Feb 7th, 2012
 

The inline keyword is a request to the compiler that you want the function body to be inserted into the compiled code as opposed to a function call. Typically used for functions that are called very ofter and perform a very simple function, e.g size(){ return m_size;}. The advantage is better performance but can lead to large executable size.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions