Re: Proper Tail Recursive C++

bothner@cygnus.com (Per Bothner)
23 Feb 1997 22:37:55 -0500

          From comp.compilers

Related articles
Proper Tail Recursive C++ jerpat@iastate.edu (Jerry) (1997-02-20)
Re: Proper Tail Recursive C++ sc@informatik.uni-jena.de (Sebastian Schmidt) (1997-02-22)
Re: Proper Tail Recursive C++ hbaker@netcom.com (1997-02-22)
Re: Proper Tail Recursive C++ will@ccs.neu.edu (William D Clinger) (1997-02-23)
Re: Proper Tail Recursive C++ fjh@mundook.cs.mu.OZ.AU (1997-02-23)
Re: Proper Tail Recursive C++ bothner@cygnus.com (1997-02-23)
Re: Proper Tail Recursive C++ andy@wonderworks.co.uk (Andy Armstrong) (1997-02-27)
Re: Proper Tail Recursive C++ gary@wheel.tiac.net (1997-03-01)
Re: Proper Tail Recursive C++ Wilco.Dijkstra@armltd.co.uk (Wilco Dijkstra) (1997-03-01)
Re: Proper Tail Recursive C++ hbaker@netcom.com (1997-03-05)
Re: Proper Tail Recursive C++ njl@cyberpass.net (1997-03-09)
Re: Proper Tail Recursive C++ hbaker@netcom.com (1997-03-13)
[5 later articles]
| List of all articles for this month |
From: bothner@cygnus.com (Per Bothner)
Newsgroups: comp.compilers
Date: 23 Feb 1997 22:37:55 -0500
Organization: Cygnus Solutions, CA
References: 97-02-111 97-02-126
Keywords: C++, optimize

Sebastian Schmidt <sc@informatik.uni-jena.de> wrote:
>Do you mean a compiler which is able to transform tail recursive
>functions into loops? According to the documentation GCC does this.
>I haven't, however, tested if it works for C++.


We need to distinguish (self-) tail recursion and general tail calls.
Gcc can eliminate direct (named) calls to the current function,
i.e. simple tail-recursion. However, general tail-call elimination as
required for Scheme (e.g. indirect tail-calls and mutual recursion)
are beyond Gcc. (It has been discussed, and would be very useful for
people implementing Scheme and other languages that require general
tail-call-elimination.)
--
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner
--


Post a followup to this message

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