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 multilevel inheritance explain with example?
Why is polymorphism important in oop?
What are the two different types of polymorphism?
write a program that takes input in digits and display the result in words from 1 to 1000
What is polymorphism and types?
What are the components of marker interface?
What do you mean by overloading?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
What is coupling in oop?
What are the 5 oop principles?
What does no cap mean?
Can we have inheritance without polymorphism?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
What is polymorphism explain its types?