Differences between inline functions and non-inline functions?
Answer Posted / madhu
Actually inline functions are used to overcome the demerits
of preprocessor macros and non-inline functions.
Whenever a function call is made function address, formal
arguments and return address will be stored in the stack.
Which leads the overhead to the compiler. To overcome this
inline functions are introduced.
Inline functions are the requester to the compiler to
replace the function definition at the function callers.
Here it is same as preprocessor macros but not equal to 100%
to macros.
The decision of implementing inline is done by compiler.
Points to be consider b/w inline && non-inline functions:
1. inline executes faster than non-inline functions.
2. Using inline will increase the code size than the
non-inline functions.
3. inline are ignored if the function definition contains
more code or loops or conditions.
4. if you define a function inside the class by default it
will treat it as a inline.
Is This Answer Correct ? | 34 Yes | 3 No |
Post New Answer View All Answers
What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?
What does and I oop mean in text?
What is abstraction and encapsulation?
What does and I oop mean?
What does it mean when someone says I oop?
what is difference between class template and template class?
Can we have inheritance without polymorphism?
Which method cannot be overridden?
What is variable example?
write a program to find 2^n+1 ?
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
What is multilevel inheritance in oop?
What is protected in oop?
Explain the advantages of inheritance.
What is difference between data abstraction and encapsulation?