Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Dubious C code Message-ID: <9658@smoke.BRL.MIL> Date: 16 Feb 89 04:45:23 GMT References: <1508@zen.UUCP> <9619@smoke.BRL.MIL> <5251@cognos.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <5251@cognos.UUCP> alanm@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..