Skip to content
Prev 313614 / 398502 Next

recursion depth limitations

On 14 December 2012 12:13, Suzen, Mehmet <suzen at acm.org> wrote:
Isn't it logical to translate any recursive function to tail-recursive
internally? While tail-recursive
version returns a value but the operation is essentially the same. I don't know
how difficult to do it generically but maybe there is an advantage of
keeping recursion
as it is. What would that advantage be?

For example, tail recursion would run but not the recursive version:
Error: C stack usage is too close to the limit
Error: C stack usage is too close to the limit
user  system elapsed
      0       0       0