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


Please Help Members By Posting Answers For Below Questions

What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2097


What does and I oop mean in text?

616


What is abstraction and encapsulation?

565


What does and I oop mean?

610


What does it mean when someone says I oop?

574






what is difference between class template and template class?

2154


Can we have inheritance without polymorphism?

605


Which method cannot be overridden?

573


What is variable example?

592


write a program to find 2^n+1 ?

1540


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?

1386


What is multilevel inheritance in oop?

549


What is protected in oop?

598


Explain the advantages of inheritance.

666


What is difference between data abstraction and encapsulation?

612