Tail recursion

strohm@airmail.net (John R. Strohm)
10 Aug 2000 00:08:04 -0400

          From comp.compilers

Related articles
Tail recursion strohm@airmail.net (2000-08-10)
Re: Tail recursion pfaffben@msu.edu (Ben Pfaff) (2000-08-13)
Re: Tail recursion danwang+news@cs.princeton.edu (Daniel C. Wang) (2000-08-14)
Re: Tail recursion toon@moene.indiv.nluug.nl (Toon Moene) (2000-08-14)
Re: Tail recursion fjh@cs.mu.OZ.AU (2000-08-21)
Re: Tail recursion Wilco.Dijkstra@arm.com (Wilco Dijkstra) (2000-08-21)
Re: Tail recursion mrs@kithrup.com (2000-08-21)
[6 later articles]
| List of all articles for this month |

From: strohm@airmail.net (John R. Strohm)
Newsgroups: comp.compilers
Date: 10 Aug 2000 00:08:04 -0400
Organization: Internet America
Keywords: optimize, question

While kicking around some ugly C code, and clearing the cobwebs by
re-reading the Wizard Book, I stumbled once again across the tail
recursion optimization. (If the recursive call doesn't require any
processing on the result from the recursion, beyond passing it back to
the caller, then the recursion can be turned into a simple branch.)

Scheme compilers are of course required by the IEEE Scheme
specification to do this.

Do any of the commonly-available compilers for "mainstream" languages
do tail recursion optimization? In particular, any C, c++, or Ada

Reason I ask: For some algorithms, the recursive formulation is
actually easier to understand, and MUCH easier to reason with.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.