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 are benefits of oop?
What is the use of oops?
What is destructor give example?
How can you overcome the diamond problem in inheritance?
What is ambiguity in inheritance?
What is difference between inheritance and polymorphism?
Explain virtual inheritance?
What is property in oops?
What are the features of oop?
#include
Explain the advantages of inheritance.
How do you define social class?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
Do you know about multiple inheritance?
What is meant by multiple inheritance?