GeekInterview.com
Series: Subject: Topic:
Question: 18 of 267

inline functions advantages

what is the inline function and what is the use of inline function?
Asked by: arjunk | Member Since Dec-2011 | Asked on: Dec 6th, 2011

View all questions by arjunk

Showing Answers 1 - 2 of 2 Answers
Amit

Answered On : 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.


  
Login to rate this answer.
Paul_Singh

Answered On : Feb 7th, 2012

View all answers by Paul_Singh

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.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.