A good use of a bad feature

aglew at ccvaxa.UUCP aglew at ccvaxa.UUCP
Sun May 11 06:19:00 AEST 1986


>/* Written 10:49 am  May  4, 1986 by root at icst-cmr in net.lang.c */
>You will find much disagreement on that point, I'm afraid. Fall thru is
>more flexible. You can always break, but often cases are related so that
>a particular case requires a superset of another case. It is to DMR's
>credit that he realized this feature. I sure wouldn't have thought of it.
>/* End of text from net.lang.c */

And what do you do if you have more than one case which is a superset of
another? Eg.

	case A      case B
	      \    /
	       \  /
             case C
                |
                |
                break

Dup code or use gotos. The worst is when people use combinations of gotos
and fall-through:

	case A: 
		...
		goto case_C;
	case B:
		...
		/* fall through */
	case C:
	case_C:
		...
		break;

There should be one way to do things. Special case constructs should only be
used if they crop up frequently. I don't think fall through qualifies.

Andy "Krazy" Glew. Gould CSD-Urbana.    USEnet:  ihnp4!uiucdcs!ccvaxa!aglew
1101 E. University, Urbana, IL 61801    ARPAnet: aglew at gswd-vms



More information about the Comp.lang.c mailing list