Breaking out of labeled statements - (nf)
Guy Harris
guy at rlgvax.UUCP
Thu Sep 1 10:07:30 AEST 1983
"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
More information about the Comp.lang.c
mailing list