On Thu, 28 Oct 1999, Caolan McNamara wrote:
> On 28-Oct-99 John P . Looney wrote:
> Reminds me of the horrors of using recursion in the real world. I
> remember on co-op some moronic computer science character had
> decided to write some bastardized linked list adder using recursion,
> sure it works fine on those imaginary computers, but in the real world
> embedded dos system that it went into it just *ATE* stack space, and
> when adding something like the 300th entry if ran out of stackspace and
> just barfed and died. A complete nightmare to find, coz theres nothing wrong
> in the way of syntax, and with simple short test all would work fine, it
> would only happen during a very long test, overnight in this case.
> Luckily the idiot who had written it had left the company just a week
> or so before I found this obscenity hidden away in the bowels of the
> system. Never liked recursion after that. If theres any feasable non
> recursion way of doing it, do that instead. Or stick a big static variable
> into the middle of it and limit the depth of it to some known value, gagh!
>
I'd say thats because Computer Scientists often spout about the merits of
recursion and rarely consider what happens on the real machine in terms of
stack space and function call overhead. It means many algorithms that
could be solved through iteration are solved with recursion because it
looks cooler or on an ideal machine with infinite memory and no function
overhead and/or would be smaller. Computer Science is too theoritical for
it's own good and that poor chap was one result of it.
It's all great and grand doing a course that concentrates on programming
theory but the silly thing should concentrate a bit on programming itself
a bit more.
Mel (Doing computer science degree)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!