Path: utzoo!mnetor!uunet!husc6!bloom-beacon!athena.mit.edu!wesommer From: wesommer@athena.mit.edu (William E. Sommerfeld) Newsgroups: comp.lang.c++ Subject: Re: QUESTIONS, QUESTIONS. Message-ID: <2643@bloom-beacon.MIT.EDU> Date: 29 Jan 88 14:56:26 GMT References: <731@entropy.ms.washington.edu> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: wesommer@athena.mit.edu (William E. Sommerfeld) Organization: Massachusetts Institute of Technology Lines: 20 In article <731@entropy.ms.washington.edu> vonn@entropy.UUCP (Vonn Marsch) writes: >1. Most LISP compilers know to compile tail-recursive functions > as iteration. Are most c++ preprocessors this smart? The GNU C compiler (and, presumably, the GNU C++ compiler, since they're based on the same code generator and optimizer) special-case self-tail-recursion. This is probably because Stallman has a strong background of work on LISP systems and LISP compilers. Interestingly enough, GCC uses a fair amount of tail recursion internally; GCC-compiled-with-GCC uses noticeably less stack space than if compiled with other compilers. So, if you use the AT&T C++->C compiler with GCC, or GNU C++, you wind up with a compiler which knows how to deal efficiently with tail recursion. Note that GCC is very much in beta test, and GNU C++ is very much in alpha test. - Bill