Is there ANY chance we can fix the bitwise operator precedence

bearophile bearophileHUGS at lycos.com
Sun Jun 20 19:00:46 PDT 2010


Michel Fortin:
> But what about the "case 1: ... case 10:" syntax?
> 
> 	switch (x) {
> 		case 1: .. case 10:
> 		case 22: .. case 32:
> 		case 52, 64:
> 			doSomething();
> 			break;
> 		default:
> 			whatever();
> 			break;
> 	}

Sorry, in my first answer I have a bit partially misunderstood your question.
You can write that like this, but I think this is not compatible with the current syntax (after commas you can of course add a newline):

case 1: .. case 10, case 22: .. case 32, 52, 64:

Otherwise you can keep them splitted (this needs no syntax changes):

                case 1: .. case 10: goto case;
                case 22: .. case 32: goto case;
                case 52, 64:

One of my original proposals was this, that now can not be used:
case 1 ... 10, 22 ... 32, 52, 64:

Bye,
bearophile


More information about the Digitalmars-d mailing list