Re: Proper Tail Recursive C++

hbaker@netcom.com (Henry Baker)
22 Feb 1997 23:05:26 -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)
[9 later articles]
| List of all articles for this month |
From: hbaker@netcom.com (Henry Baker)
Newsgroups: comp.compilers
Date: 22 Feb 1997 23:05:26 -0500
Organization: nil
References: 97-02-111
Keywords: C++, optimize

"Jerry" <jerpat@iastate.edu> wrote:


> Does anybody know if there exists a C++ compiler that is properly tail
> recursive? Please tell me where and how I could get my hands on one.


There's a bit of a problem defining exactly what you mean by 'properly
tail recursive C++'. If local storage is allocated in the stack frame
and is still 'live' at the time of the tail-call, then you can't just
're-use' the stack frame. The problem is that C/C++ mixes the control
stack with the data stack. Tail-calling saves space on the control
stack, but not necessarily on the data stack.


In the particular case where no storage is 'live' at the time of the
tail call, then I've been told that some versions of GNU may do the
right thing.
--


Post a followup to this message

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