problems/risks due to programming language, stories requested

Tony Sanders sanders at sanders.austin.ibm.com
Sat Mar 10 06:13:10 AEST 1990


In article <8218 at hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu writes:
>   So is a multi-alternative case, as provided by Ada:
How do you do this in ADA?

    switch(n) {
      case 0:
	count++;
      case 1:
	ocount++;
      case 2:
	printf("%d %d\n",count,ocount);
	break;
      default:
	printf("unknown n\n");
	break;
    }

See how I left out the breaks on purpose.

In ADA you wouldn't be able to do this without duplicating either the
case-expression (they aren't always simple numbers) or the statements.

-- sanders                The 11th commandment: "Thou shalt use lint"
For every message of the day, a new improved message will arise to overcome it.
Reply-To:  cs.utexas.edu!ibmaus!auschs!sanders.austin.ibm.com!sanders



More information about the Comp.lang.c mailing list