+ 8
Is it possible to have a recursive inline function ?
7 odpowiedzi
+ 5
Inline is just a request to the compiler to treat the call to a function like a macro and substitute it rather than treating it as a function and making a call. This request may or may not be considered by a compiler where in the second case it treats it as a normal function rather than inline. So even though you do try to make a recursive function inline the compiler will ignore it and consider it as a normal function and work in the normal fashion to execute it.
P.S Doing this is definitely not a good coding practice.
+ 6
You can see this for references
https://stackoverflow.com/questions/190232/can-a-recursive-function-be-inline
Good Luck~
+ 4
I would say that compilers would probably never inline a recursive function.
+ 2
Yaa Right
+ 2
Although you can call an inline function from within itself, the compiler will not generate inline code since the compiler cannot determine the depth of recursion at compile time.
+ 1
Yessssss it's possible