Is it possible to have a recursive inline function in C++?

devquora
devquora

Posted On: Feb 22, 2018

 

Although a user can call an inline function from within itself, the compiler may not generate the inline code as the compiler is unable to determine the depth of recursion at compile time. A compiler with a good optimizer can inline recursive calls until 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.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    C++ Interview Questions

    Explain what is OOP?

    Object-oriented programming (OOP) is a type of computer programming, also more commonly known as software design, in wh..

    C++ Interview Questions

    What is the difference between #import and #include in C++?

    The statement #include is used in C++ to include the source file or import the header files containing definitions of f..

    C++ Interview Questions

    What is ‘this’ pointer?

    The ‘this’ pointer is passed as a hidden argument to all the non-static member method calls and is available as a l..