steve@tellab5.tellabs.CHI.IL.US (Steve Harpster) (05/31/89)
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....