top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In C++, "inline function" will not work if there is a Recursion, Right?

+1 vote
434 views

1)I have an inline function with recursion, when i compiled it i am not seeing any Error/Warning for that why?
2)As far as i know its compiler dependent whether to copy inline function or not, but my question is how we will get to know whether compiler has added inline function or not?
3)In What stage of compilation Inline function will be copied?

posted Jun 4, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Making a function "inline" is just a request to compiler, that request may be accepted or rejected by compiler based on the type of statements written within the function.
- Compiler rejects inline request for recursive function.
- Compiler replaces inline function with its body in pre-processing phase.
- Compiler doesn't generate errors since these steps are part of pre-processing

answer Jun 4, 2015 by Harshita
Similar Questions
+5 votes

I have few queries about inline function, can anyone please help?

  1. In what stage of compilation inline function is replaced with function call?
  2. Under what conditions inline function will fail?
  3. How to verify whether inline function is successfully replaced or not?
+2 votes

I would like to know, if there is any difference (in allocated memory space) between defining a function inline in the class declaration (with the inline word), and defining a function inline explicit after the class declaration.

...