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: 102b75,14f3fa9fb2c63b2d X-Google-Attributes: gid102b75,public X-Google-Thread: f678f,14f3fa9fb2c63b2d X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-12-15 10:47:26 PST Xref: gmd.de comp.lang.misc:5279 comp.lang.c++:40656 comp.arch:18179 comp.unix.osf.misc:833 Path: gmd.de!xlink.net!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 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. I think the best you can really hope for, in the absence of real definitions, is "best effort" from the compiler to remove stack frames for tail calls. And some C compilers are already pretty good at that. >Indirect jumps are useful to implement higher order functions and the >socalled "tagless" abstract machines. Something akin to the assigned >goto of Fortran is O.K. I don't suggest pointer arithmetic on jumps, >though I'm sure some C-hackers would love that ;-). Gcc has a facility along these lines. Does that suffice? Hans-J. Boehm (boehm@parc.xerox.com) Standard disclaimer ...