An inline function is expanded duringa.run-timeb.end of the programc.never expandedd.compile-time
Question
An inline function is expanded during
- a. run-time
- b. end of the program
- c. never expanded
- d. compile-time
Solution
An inline function is expanded during compile-time. So, the correct answer is d. compile-time.
Here's a step-by-step explanation:
-
An inline function is a function that is expanded in line when it is called. When the inline function is called whole code of the inline function gets inserted or substituted at the point of inline function call.
-
This substitution is performed by the compiler at compile time.
-
The main advantage of this is that it reduces the function call overhead.
-
So, the inline function is expanded during compile-time, not at run-time or the end of the program. It's also not correct to say that it's never expanded.
Similar Questions
Dynamic memory allocation/linking of program is done duringSelect one:a. compilationb. executionc. none of the aboved. loading
Dynamic memory allocation/linking of program is done duringSelect one:a. loadingb. executionc. compilationd. none of the above
Where to put inline function during the frequent calling inside the program from multiple source files?
Which of the following is an example of runtime polymorphism?Function overloadingOperator overloadingVirtual functionsInline functions
Run-time errors are less desirable than compile-time errors. What do you think is the reason for this?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.