🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #4221

Re: Stupid programming errors

#4221
From: t... Andrew Tannenbaum
Date: Wed, 12 Sep 1990 21:00
23 lines
1376 bytes
We found some C code around here not too long ago that looked
something like this:

	for (i=0; i<10; i++) {
		switch (i) {
		case 0: <random code> break;
		case 1: <random code> break;
		case 2: <random code> break;
		...
		case 9: <random code> break;
		}
	}

Yes, the loser was using a for loop and a switch to impart default
sequential control flow on a section of code.

Added silly note...  I wonder how many C programs there are out there
which have "default" switch conditions where default is spelled wrong
(making it look like a goto label).  I've seen defualt at least, and I
know I've seen this bug on several occasions, in such places as
the AT&T 5.3 sources.

	Andrew Tannenbaum   Interactive   Cambridge, MA   +1 617 661 7474
Technical Details
Message-ID: <17994@haddock.ima.isc.com>
Path: mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!snorkelwacker!mintaka!spdcc!ima!haddock!trb
References: <3056.26e4dd44@cc.helsinki.fi> <119586@linus.mitre.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!snorkelwacker!mintaka!spdcc!ima!haddock!trb
From: t...@haddock.ima.isc.com (Andrew Tannenbaum)
Newsgroups: alt.folklore.computers
Subject: Re: Stupid programming errors
Message-ID: <17994@haddock.ima.isc.com>
Date: 12 Sep 90 21:00:55 GMT
References: <3056.26e4dd44@cc.helsinki.fi> <119586@linus.mitre.org>
Reply-To: t...@haddock.ima.isc.com (Andrew Tannenbaum)
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 23
Posted: Wed Sep 12 22:00:55 1990
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit