vonn@entropy.ms.washington.edu (Vonn Marsch) (01/29/88)
I have some questions, most of which I'm sure are repeats (I've only begun to read this newsgroup), but I must have answers. 1. Most LISP compilers know to compile tail-recursive functions as iteration. Are most c++ preprocessors this smart? 2. (A classic) Whats the best book on c++ for someone who's used c for years? 3. Where, and for what hardware, are c++ preprocessors available? Any clues on any of these questions would be appreciated. Vonn Marsch
wesommer@athena.mit.edu (William E. Sommerfeld) (01/29/88)
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