Dubious C code
Doug Gwyn
gwyn at smoke.BRL.MIL
Thu Feb 16 14:45:23 AEST 1989
In article <5251 at cognos.UUCP> alanm at cognos.UUCP (Alan Myrvold) writes:
>I didn't realize that a CASE statement within the body of a FOR loop
>was legitimate C code, and just a stupid algorithm.
Surprise!
>VAX/VMS cc does have the sense to complain :
>%CC-E-NOTSWITCH, Default labels and case labels are
> valid only in "switch" statements.
That compiler is broken -- the case label WAS inside a switch body.
I admit that making use of this language feature is almost always
ill-advised (and, apparently, not portable to VAX/VMS). "Duff's
device" makes use of it in an essential way, though..
More information about the Comp.lang.c
mailing list