C++ Programmer Question:

Explain is it possible to have a recursive inline function?

C++ Programmer Interview Question
C++ Programmer Interview Question

Answer:

Although you can call an inline function from within itself, the compiler may not generate inline code since the compiler cannot determine the depth of recursion at compile time. A compiler with a good optimizer can inline recursive calls till some depth fixed at compile-time (say three or five recursive calls), and insert non-recursive calls at compile time for cases when the actual depth gets exceeded at run time.


Previous QuestionNext Question
Tell me is it possible to get the source code back from binary file?Do you know who designed C++ programming language?