Indeed the C/C++ compilers I've used lately don't eliminate tail recursion. GCC used to do it, but later versions don't seem to work. MS Visual C has never worked. On the other hand, all functional language compilers are similar in this respect to Scheme. They need to be since tail recursion is necessary for iterative computations. Examples include all usable implementations of SML, Haskel, Common Lisp, Prolog, and others.
- [algogeeks] Re: recursion question Gene