From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f891f,14f3fa9fb2c63b2d X-Google-Attributes: gidf891f,public X-Google-Thread: 109fba,14f3fa9fb2c63b2d X-Google-Attributes: gid109fba,public X-Google-Thread: f678f,14f3fa9fb2c63b2d X-Google-Attributes: gidf678f,public X-Google-Thread: 102b75,14f3fa9fb2c63b2d X-Google-Attributes: gid102b75,public X-Google-ArrivalTime: 1993-12-16 07:28:03 PST Xref: gmd.de comp.lang.misc:5285 comp.lang.c++:40735 comp.arch:18195 comp.unix.osf.misc:840 Newsgroups: comp.lang.misc,comp.lang.c++,comp.arch,comp.unix.osf.misc Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!dent.uchicago.edu!mps From: mps@dent.uchicago.edu (Michael Spertus) Subject: Re: ANDF - some (mis)information Message-ID: <1993Dec16.143615.6064@midway.uchicago.edu> Sender: news@uchinews.uchicago.edu (News System) Organization: Dept. of Mathematics References: <2el49dINN638@network.ucsd.edu> <1993Dec15.121017.16629@odin.diku.dk> <2enk32$oi7@news.parc.xerox.com> Date: Thu, 16 Dec 1993 14:36:15 GMT >From uchinews!ncar!gatech!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!decwrl!parc!boehm Thu Dec 16 08:31:25 CST 1993 Article: 9856 of comp.lang.misc Xref: uchinews comp.lang.misc:9856 comp.lang.c++:54108 comp.arch:30194 comp.unix.osf.misc:835 Path: uchinews!ncar!gatech!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!decwrl!parc!boehm From: boehm@parc.xerox.com (Hans Boehm) Newsgroups: comp.lang.misc,comp.lang.c++,comp.arch,comp.unix.osf.misc Subject: Re: ANDF - some (mis)information Date: 15 Dec 1993 18:12:50 GMT Organization: Xerox Palo Alto Research Center Lines: 36 Message-ID: <2enk32$oi7@news.parc.xerox.com> References: <2el49dINN638@network.ucsd.edu> <1993Dec15.121017.16629@odin.diku.dk> NNTP-Posting-Host: siria.parc.xerox.com [I suggest we move this discussion to just comp.lang.misc] torbenm@diku.dk (Torben AEgidius Mogensen) writes: >>Two things that I (and others) have missed in C as an intermediate >>language for implementation of functional languages are tail-call >>optimization and indirect jumps. >>Tail-call optimization means that you are guarateed that if the last >>thing you do in a procedure or function is to call another procedure >>or function, then all the stack space that the calling function uses >>is removed from the stack before the called function uses any stack >>space. This ensures constant stack usage of tail-recursive (mutually) >>recursive functions. >This is not safe in C, since pointers into the callers activation >record may still be around. I've never managed to understand what >the corresponding "guarantee" in scheme meant, either. Parts of >the callers environment may also escape there. In scheme, environment >growth in response to a tail call somehow doesn't count. There is a safe implementation. Simply replace the parms in the current stack frame with those that would have been pushed by the call and jump back to the top. This only becomes trouble where the address of something in the current frame is passed to the next frame. There can be a warning about that.