🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #43289

LSC 3.0 and labels

#43289
From: Steve Harpster
Date: Wed, 31 May 1989 16:32
24 lines
1142 bytes
Here's an interesting bug that took me 2 days to figure out.  

In the constant switch from C to Pascal and back, I forget to put the
word "case" before every case statement in C.  In particular, I had

	switch(event.what) {
	updateEvt:
		...
	activateEvt:
		...
	}

Lightspeed C 3.0 compiled this just fine!.  I pulled my hair out in the
debugger trying to figure out why it kept skipping over my cases in the
switch.

I presume that LSC thought "updateEvt" and "activateEvt" were labels for
goto's.  The problem is that these are defines and resolve to integers.
K&R states that labels have the same form as variables and must not start
with a numeral.  I think the compile should have choked with an "illegal
label" message.  

Let the programmer beware....
Technical Details
Message-ID: <1371@tellab5.tellabs.CHI.IL.US>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!tellab5!steve

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!tellab5!steve
From: steve@tellab5.tellabs.CHI.IL.US (Steve Harpster)
Newsgroups: comp.sys.mac
Subject: LSC 3.0 and labels
Message-ID: <1371@tellab5.tellabs.CHI.IL.US>
Date: 31 May 89 16:32:28 GMT
Reply-To: steve@tellab5.UUCP (Steve Harpster)
Organization: Tellabs, Inc., Lisle, IL
Lines: 24