Differences between inline functions and non-inline functions?
Answers were Sorted based on User's Feedback
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 |
Answer / rajesh kumar
In non-inline function when a function calls the controller
jumps to the function definition, but whereas in Inline
Function when a function calls the code in the function
replaced instead of jumping the controller.
| Is This Answer Correct ? | 35 Yes | 11 No |
Answer / ashu_deepu
inline function are those function in which the code is just inserted where the function is declared.
it is generally used for function which are small in size and don,t involve any loop.
it just a way to decrease the time of function call.
| Is This Answer Correct ? | 12 Yes | 3 No |
Answer / ankita
inline functin for execution switching time is required but
noy in case of non inline function
| Is This Answer Correct ? | 1 Yes | 5 No |
why function overloading is not called as pure polymorphism?
how to find the largest of given numbers in an array
what is the 3 types of system development life cycle
What Is a Polymorphism? How many types of polymorphism and whats that use in application?
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
What is encapsulation process?
What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the scope resolution operator while accessing them. I want to know some other advantages of unnamed namespaces...
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
pointers are support in C#? if yes then how to use it?
8 Answers Softvision Solution,
What is difference between new and malloc?
What is overriding in oops?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.