I almost understand how tail recursion works and the difference between it and a normal recursion. I only don\'t understand why it doesn\'t
My answer is more of a guess, because recursion is something relating to internal implementation.
In tail recursion, the recursive function is called at the end of the same function. Probably compiler can optimize in below way:
As you can see, we are winding up the original function before the next iteration of the same function, so we are not actually "using" the stack.
But I believe if there are destructors to be called inside the function then this optimization may not apply.