9 replies
by macbouy
Yes, if you have a Microsoft compiler, use:
#pragma inline_recursion( [{on | off}] )
Recursive functions usually aren't candidate for inline function protocol.
by wayne m.
Yes and No. You can use the inline syntax to declare the function, but it will probably be compiled as a normal subroutine because the code cannot be infinitely unwrapped. "inline" is only a hint to the compiler and it can decide not to inline code if need be.
Loops are usually more appropriate than recursive calls in inline functions, and loops will be actually compiled as true inline code.
by dachev
by vickydicky
Yes Inline functions can call itself, becuz prefixing inline the declaration is just request to the compiler that if it is possible to u(compiler) pleaes make this function as inline.This(inline) function is same as the normal function.
But what's the use of this(recursive) with Inline function. Inline function are used to increase the execution time.When u make such request using keyword in declaration compiler will try to put the code wherever it is called so that it can save the time. Sothat by requesting Inline to recursive function means ur requesting to increasing the size of ur programm, which ultimately slowdown ur programme.
So it is better not use inline function if u want that function calls itself.(i.e. recursive)
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending