Is there ANY chance we can fix the bitwise operator precedence
KennyTM~
kennytm at gmail.com
Sat Jun 19 11:18:54 PDT 2010
On Jun 19, 10 17:56, bearophile wrote:
> KennyTM~:
>> 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;
>> }
>
> I didn't know this, this is a hidden D feature. So it's just a matter of D forbidding the cases that miss an explicit return, goto, or break, assert(0), exit(), and similar.
>
> As for the multiple returns in a function this needs a bit of care because this is acceptable:
>
> switch (x) {
> case 0:
> if (y)
> goto case;
> else
> return x;
> default:
> break;
> }
>
> Bye,
> bearophile
Actually it's not hidden :)
http://www.digitalmars.com/d/1.0/statement.html#GotoStatement
http://www.digitalmars.com/d/2.0/statement.html#GotoStatement
More information about the Digitalmars-d
mailing list