The D Switch Loop??
Kevin Braunsdorf
ksb at j.cc.purdue.edu
Wed Mar 2 02:39:15 AEST 1988
For a replacement for C why can't we make a switch statement loop? We
can make switch less of a hack in the lanuage.
Make the switch loop be default so we trap switches without a default.
switch (func(param)) {
case (0):
param = dosomething();
continue;
case (1):
param = tryagain();
continue;
case (2):
param = stillanother();
continue;
case (3):
default:
break;
}
This way we have a DFA. Maybe we can even dink the ':' after the
case.
Kevin S Braunsdorf
ksb at s.cc.purdue.edu
More information about the Comp.lang.c
mailing list