The Sins of K&R

Scott Merrilees Sm at cerberus.bhpese.oz.au
Tue Oct 2 14:10:30 AEST 1990


volpe at underdog.crd.ge.com (Christopher R Volpe) writes:
>How about combining the "let's make break implicit" idea with the
>"lets add ranges and lists" idea and solve everybody's problems? E.g.:

>ch = getch();
>switch (ch) {
>  case 'q','Q',27,13:
>    exit_menu=1;
>  case 'a':
>    do_a();
>  ...etc
>}

>Now, a break within a case can be used to break out of an enclosing loop,
>and the "multi-case" capability is still maintained.                    

I still want to be able to do:

	switch ( var )
	{
	case '1':
		func1();
	case '2':
		func2();
	default:
		func3();
		break;
	}

Sm
--
Scott Merrilees, BHP Rod & Bar Products Division, Newcastle, Australia
INTERNET: Sm at bhpese.oz.au      UUCP: ...!uunet!bhpese.oz!Sm



More information about the Comp.lang.c mailing list