Scope of switch statements

P E Smee exspes at gdr.bath.ac.uk
Tue Nov 14 21:42:03 AEST 1989


In article <1989Nov9.200639.8868 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <15743 at bloom-beacon.MIT.EDU> tada at athena.mit.edu (Michael J Zehr) writes:
>>is this obfuscated code not ANSI or is the compiler broken?  
>
>It is legal, although ugly, ANSI C.  Also legal (but ugly) traditional C.
>Dennis Ritchie himself has officially blessed this disgusting construct,
>and indeed it has one or two legitimate uses.

Can you point me at a reference in 'The C programming language' (or in
any other reference that I'm likely to be able to find)?  I'm *not*
doubting you, but I *would* like to know exactly what it is supposed
to mean, then.  In particular, if you branch (via the switch) to one
of the cases inside the {}'s of the for, are you then under control of
the for?  That is, do you iterate the for or do you fall out of the
bottom bracket on the first go-through?

-- 
 Paul Smee               |    JANET: Smee at uk.ac.bristol
 Computer Centre         |   BITNET: Smee%uk.ac.bristol at ukacrl.bitnet
 University of Bristol   | Internet: Smee%uk.ac.bristol at nsfnet-relay.ac.uk
 (Phone: +44 272 303132) |     UUCP: ...!uunet!ukc!gdr.bath.ac.uk!exspes



More information about the Comp.std.c mailing list