C Bug (he meekly asks) ?

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Thu Mar 28 01:25:17 AEST 1991


In article <1991Mar26.235622.20057 at colorado.edu> rainer at boulder.Colorado.EDU (Rainer Malzbender) writes:
>I inadvertently typed "case_3:" instead of "case 3:" in a 'switch'
>statement. Now I'm certainly no guru on the arcane features of the
>C language, but shouldn't this be illegal and at least cause a
>compiler error? My program compiled and ran fine. As far as I can tell
>from the .s output (I don't grok R3000 assembler) it just trashed
>the whole clause.

Realize that ':' also stands for a label in C, and so your case_3:
statement was treated as a label, where later in the program you could
possibly say "goto case_3". Certainly not what you intended, but nevertheless
quite legal.

				-Kartik
--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao at phoenix.Princeton.EDU -| Internet
kartik at silvertone.Princeton.EDU (NeXT mail)  
SUBBARAO at PUCC.BITNET			          - Bitnet



More information about the Comp.sys.sgi mailing list