Please quote enough context when replying to a message -- otherwise,
people who could give you a good answer if they had the necessary
context cannot do so.
Aloo wrote:
[inlining of recursive functions into iterations?]
The code compiles succesfully, but does the compiler know at compile
time at how many places to insert the code, since the number of times
the code executes depends upon the input at runtime.
Well, there are three possibilities for the special case of everything
known at compile time:
1) The compiler ignored the "inline". This is easiest, thus the most
probable course.
2) The compiler replaced the body of the function by an equivalent
iteration and had to inline only once.
3) The compiler figured out the necessary recursion depth for each and
every call and inserted appropriately many calls. This is the most
unlikely.
In principle, depending on the semantics of your function, all three
are possible for runtime inputs, too, but the latter becomes even
more unlikely (but could still be applicable if the inlined function
is essentially a contraction and there are limits on the processed
type).
The answer to your question depends completely on your compiler and
the compiler settings.
Is there any method to Actually debug the executed code and see for
myself whether it is recursive or iterative ?
Usually not. Many compilers do not generate the same code in debug
mode. Even if they did, the debugger may then seemingly step over
the call of the inlined function.
Certainty can only be gained from looking at the compiler output.
Most compilers give you a chance to do so.
Cheers
Michael