|Tail recursion firstname.lastname@example.org (2000-08-10)|
|Re: Tail recursion email@example.com (Ben Pfaff) (2000-08-13)|
|Re: Tail recursion firstname.lastname@example.org (Daniel C. Wang) (2000-08-14)|
|Re: Tail recursion email@example.com (Toon Moene) (2000-08-14)|
|Re: Tail recursion firstname.lastname@example.org.OZ.AU (2000-08-21)|
|Re: Tail recursion Wilco.Dijkstra@arm.com (Wilco Dijkstra) (2000-08-21)|
|Re: Tail recursion email@example.com (2000-08-21)|
|Re: Tail recursion firstname.lastname@example.org (2000-09-08)|
|Tail recursion Alexey.Mikhailov@gmail.com (jjb) (2006-11-04)|
|Re: Tail recursion email@example.com (russell kym horsell) (2006-11-04)|
|Re: Tail recursion firstname.lastname@example.org (2006-11-05)|
|Re: Tail recursion email@example.com (Oliver Wong) (2006-11-08)|
|[1 later articles]|
|From:||Wilco Dijkstra <Wilco.Dijkstra@arm.com>|
|Date:||21 Aug 2000 00:03:14 -0400|
|References:||00-08-054 00-08-071 00-08-089|
"Daniel C. Wang" wrote:
> > The GCC compiler suite does tail recursion optimization at least
> > for C and C++ and probably for its other languages as well.
> But only "intra-procedurally"
Tailrecursion can only be applied intra-procedurally as a special
tailcall to the same function.
[ removed some example code ]
> which a smart Scheme and ML compiler would do...
Standard tailcall optimization gives you exactly what you want
because the functions don't use the stack:
If you turn automatic inlining on all of this is academic: small functions
completely disappear. If you do tailrecursion before inlining I think you
get optimization that is close to that of functional languages: calls to
recursive functions would expand into loops.
However many C compilers do inlining before tailcall & tailrecursion...
Return to the
Search the comp.compilers archives again.