Is there ANY chance we can fix the bitwise operator precedence rules?
KennyTM~
kennytm at gmail.com
Fri Jun 18 23:17:40 PDT 2010
On Jun 19, 10 07:17, Jonathan M Davis wrote:
> bearophile wrote:
>
>> 2) switch cases that don't end with goto or break:
>>
>> void main() {
>> int x, y;
>> switch (x) {
>> case 0: y++;
>> default: y--;
>> }
>> }
>
> I, for one, _want_ case statements to be able to fall through. It would be
> horribly painful in many cases if they couldn't. Now, requiring a separate
> statement like fallthrough or somesuch instead of break might not be a bad
> idea, but requiring that each case end with a break would seriously restrict
> the usefulness of switch statements.
>
> - Jonathan M Davis
This "fallthrough" statement already exists.
switch (x) {
case 0:
do_something();
goto case;
case 1:
do_more_thing();
goto case;
case 2:
done();
break;
default:
error();
break;
}
More information about the Digitalmars-d
mailing list