Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 7/7/83; site rlgvax.UUCP Path: utzoo!linus!decvax!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: Breaking out of labeled statements - (nf) Message-ID: <1084@rlgvax.UUCP> Date: Wed, 31-Aug-83 20:07:30 EDT Article-I.D.: rlgvax.1084 Posted: Wed Aug 31 20:07:30 1983 Date-Received: Thu, 1-Sep-83 20:32:52 EDT References: <2672@uiucdcs.UUCP>, <1799@allegra.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 28 "goto"s can be used for treating several cases as subcases of one common case (i.e., do the case-specific thing and then the common actions), generally without too tangled code. Furthermore, if it *does* tangle things, or you don't want to use "goto"s, many versions of the C "final" optimizer will do the right thing if you write something like case (foo) { case 1: /* 1-specific things */ /* common code */ break; case 2: /* 2-specific things */ /* common code */ break; . . . and join the common code and stick a jump/branch instruction into the cases. (Versions known to: PDP-11, VAX-11, Zilog "Zeus", CCI - and probably most other - 68000). Guy Harris {seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy