On Tue, Dec 13, 2005 at 11:11:01PM +0000, Angus Lees wrote: > > I realise I'm a bit behind the times with continuing this thread, but > I'm surprised no-one mentioned that modern compilers are quite capable > of turning tail-recursion into in-place iteration. > [ nice example ]
I was going to mention it, but I didn't know the specifics with respect to gcc. nice! I was going to mention it as part of saying that the usual fibonacci example of recursion is a spectacularly bad example for recursion (without tail recursion elimination) because the stack grows exponentially -- there being two recursive calls for every call. -- Matt -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
