- To: malkin@xxxxxxxxxxxxxxxx, slug@xxxxxxxxxxx
- Subject: Re: [SLUG] Help Me - C codes
- From: Matthew Hannigan <mlh@xxxxxxxxxx>
- Date: Fri, 16 Dec 2005 11:25:59 +1100
- User-agent: Mutt/1.3.28i
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