🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #4224

Re: Stupid programming errors.

#4224
From: wa... David Wald
Date: Fri, 31 Aug 1990 20:53
25 lines
2030 bytes
In article <1172@meaddata.mead.UUCP> mead!gor...@uccba.uc.edu writes:
>In light of the stupid user discussion, how about a discussion of stupid and
>embarrassing programming errors.
[Story of a recursive function overflowing the stack on a long input.]

There are programming mistakes that can result, not from stupidity,
but simply from moving to a different type of programming language.  A
few years ago a friend at school showed me a program that had worked
fine when she'd tested it, but came back from grading with the
supremely unhelpful message, "This dumps core."  The assignment was a
short filter written in C.

The problem was that her previous programming course had used Scheme,
emphasizing general programming techniques.  Scheme guarantees that it
will compile a tail-recursive function into a loop.  Her filter code,
while beautifully written, was handling the main loop of the filter
tail-recursively, and the program overgrew the stack as soon as the TA
gave it too many characters of input.

She looked rather shocked when I told her that most C implementations
wouldn't handle that case nicely, but she recoded it into a while-loop.
--
============================================================================
David Wald                                           wa...@theory.lcs.mit.edu
============================================================================
Technical Details
Message-ID: <1990Aug31.205330.28527@mintaka.lcs.mit.edu>
Path: mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!sunic!hagbard!eru!bloom-beacon!mintaka!wald
References: <1172@meaddata.mead.UUCP>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!sunic!hagbard!eru!bloom-beacon!mintaka!wald
From: wa...@theory.lcs.mit.edu (David Wald)
Newsgroups: alt.folklore.computers
Subject: Re: Stupid programming errors.
Message-ID: <1990Aug31.205330.28527@mintaka.lcs.mit.edu>
Date: 31 Aug 90 20:53:30 GMT
References: <1172@meaddata.mead.UUCP>
Sender: dae...@mintaka.lcs.mit.edu (Lucifer Maleficius)
Reply-To: wa...@theory.lcs.mit.edu (David Wald)
Organization: Laboratory for Computer Science, MIT
Lines: 25
Posted: Fri Aug 31 21:53:30 1990
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit