[comp.lang.c] switch statement

hascall@cs.iastate.edu (John Hascall) (03/14/90)

/* If you REALLY hate fall-through on switch statements... */

#define when       break;case
#define or         : case
#define otherwise  break;default

void whatsit(char ch) {

        switch(ch) {
                when 'a' or 'e' or 'i' or 'u':
                        printf("it's a vowel\n");
                when 'y':
                        printf("it might be a vowel\n");
                otherwise:
                        printf("it's not a vowel\n");
        }
}
/* John Hascall  /  ISU Comp Ctr  /  hascall@atanasoff.cs.iastate.edu */

brianh@hpcvia.CV.HP.COM (brian_helterline) (03/16/90)

/ hpcvia:comp.lang.c / hascall@cs.iastate.edu (John Hascall) / 12:14 pm  Mar 13, 1990 /
/* If you REALLY hate fall-through on switch statements... */

>#define when       break;case
>#define or         : case
>#define otherwise  break;default
> { example deleted }

But everyone knows

#define or	||

is the true meaning ;)