Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!cuae2!killer!molly From: molly@killer.UUCP (Molly Fredericks) Newsgroups: comp.lang.c Subject: Re: goto's and switch statements -- mild proposal Message-ID: <1334@killer.UUCP> Date: Fri, 14-Aug-87 04:28:23 EDT Article-I.D.: killer.1334 Posted: Fri Aug 14 04:28:23 1987 Date-Received: Sun, 16-Aug-87 02:38:24 EDT References: <855@tjalk.cs.vu.nl> <2683@hoptoad.uucp> <916@haddock.ISC.COM> <13874@topaz.rutgers.edu> Organization: Plain'O Girls Home Lines: 47 Summary: You can't get there from here. In article <13874@topaz.rutgers.edu>, ron@topaz.rutgers.edu (Ron Natalie) writes: > foo() { > > switch(a) { > default: > dodefault(); > } > > goto default; > > switch(b) { > default: > hithere(); > } > } > > What happens here if you can "goto default" or "goto case"? $ ed test.c main () { switch (getchar ()) { default: puts ("not a zero"); break; case '0': puts ("was a zero"); exit (0); } goto default; } $ cc -c test.c "test.c", line 11: syntax error That's what happens if you goto default. The syntax for a goto is ::= `goto' `;' The word `default' is not an identifier, it is a reserved word. Molly -- Molly Fredericks UUCP: { any place real }!ihnp4!killer!molly Disclaimer: Neither me, nor my cat, had anything to do with any of this "I love giving my cat a bath, except for all those hairs I get on my tongue" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~