GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C++

 Print  |  
Question:  Inline Function Advantages

Answer: What are the advantages of inline functions over macros?


June 06, 2009 04:47:49 #4
 amarnathsatrawala   Member Since: June 2009    Total Comments: 3 

RE: Inline Function Advantages
 
Inline functions are not always advantageous.

They are appropriate when their impact on code size in not adverse i.e. their size is small and they are not called from too many different places.

They are suitable when they are in the deepest of the loop hierarchies. It helps remove too many fuction calls and improve performance. It may also help in better code optimizations.

The other advantages have been covered above like compiler support for type checking and facility of providing overloads.
     

 

Back To Question