Re: Proper Tail Recursive C++

gary@wheel.tiac.net (Gary D. Duzan)
1 Mar 1997 21:40:29 -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)
Re: Proper Tail Recursive C++ fjh@murlibobo.cs.mu.OZ.AU (1997-03-13)
Re: Proper Tail Recursive C++ ramsdell@linus.mitre.org (1997-03-16)
[3 later articles]
| List of all articles for this month |

From: gary@wheel.tiac.net (Gary D. Duzan)
Newsgroups: comp.compilers
Date: 1 Mar 1997 21:40:29 -0500
Organization: Brain Dead Innovations
References: 97-02-111 97-02-131 97-02-141 97-02-152
Keywords: C++, optimize

      For a proper tail call, there must be nothing left to do in the
calling function on return of the called function, including
deallocation of A[]. Therefore, to implement the tail call, either the
whole array must be copied when calling g(), or somehow g() must take
ownership of A[] and know to deallocate it when it is done. In a
garbage collected language system, you simply allocate it on the heap,
pass by reference, and let the garbage collector take care of
it. Alternatively, if the compiler can prove that A[] is dead halfway
through g(), it can insert the deallocation there.


                                                                            Gary D. Duzan
--


Post a followup to this message

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