GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 122 of 203    Print  
What is difference between inline function and ordinary function?

  
Total Answers and Comments: 6 Last Update: May 02, 2008     Asked by: ganeshkumar 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Lei
 
The difference between an inline and a regular function is that instead of calling the function, the compiler copies the function on the spot.

Above answer was rated as good by the following members:
yzesong
March 04, 2007 22:26:33   #1  
Lei        

RE: What is difference between incline function and or...
The difference between an inline and a regular function is that instead of calling the function the compiler copies the function on the spot.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
March 05, 2007 00:32:55   #2  
smart_coder Member Since: January 2007   Contribution: 290    

RE: What is difference between incline function and or...
Inline functions are just like normal functions except that they are preceded by the keyword inline!! wherever the compiler finds the call for that function it puts the code for that function dere!! the functions are defined as inline when the function is small and is called many times.
 
Is this answer useful? Yes | No
March 08, 2007 11:52:33   #3  
Pingu        

RE: What is difference between incline function and or...
The keyword inline is just a request to compiler. If the function is really big compiler may not copy the whole code and may treat it as an ordinary function.
 
Is this answer useful? Yes | No
March 13, 2007 09:07:18   #4  
saurabh08_chd        

RE: What is difference between incline function and or...
each time there's is a function call in the source file the actual code from function is inserted instead of a jump to the function.
 
Is this answer useful? Yes | No
March 14, 2007 04:39:25   #5  
sandeep chahal        

RE: What is difference between incline function and or...

the ordinary function do a lot of activity store the argument into stack saving register
control goes to the function and return value to the calling function but in inline
function body replace to the calling the function (like as macro expansion)
it is reqest to the compiler not a command compiler may ignore the request if
function is so length


 
Is this answer useful? Yes | No
May 02, 2008 08:21:19   #6  
wow_suraj Member Since: May 2008   Contribution: 22    

RE: What is difference between inline function and ordinary function?

In case of ordinary function when calling the function the scope jumps to the function and after return jumps back to the function call statement resulting in some extra execution time. While in case of inline function the scope doesn't really jumps to the function saving some execution time. However while making any function inline we are just sending request to make the function inline it completely depends on the compiler that it will treat the function as inline or some ordinary function.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape