5. Can inline functions have a recursion?

Answer Posted / jeremiah

A function that is marked "inline" can also be recursive.
- The "inline" keyword on a function definition is only a
suggestion to the compiler that this function is a good
candidate for inlining. The compiler will still have the
final say if the function can be inlined or not.
- In certain cases a function cannot be inlined even if it
has the "inline" modifier:
* You use the function as a callback which requires a
pointer to the function.
* You make a recursive call to the function that has been
marked inline. In this case, the compiler can't determine
the base case for the recursive function and theirfor can't
unroll the inline function in the recursive call. Then an
external version of the function is required.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is operator overloading in c++ example?

743


When do we run a shell in the unix system?

673


Is swift faster than c++?

648


Should a constructor be public or private?

637


Differentiate between realloc() and free().

676






What is expression parser in c++

2007


Are strings immutable in c++?

748


What is a modifier in c++?

719


What is auto type c++?

723


Why is c++ called oops?

650


What is ios in c++?

750


Explain Memory Allocation in C/C++ ?

717


Explain selection sorting. Also write an example.

683


What is the difference between cin.read() and cin.getline()?

655


Differentiate between the manipulator and setf( ) function?

704