About switch case statements...
Denis Koroskin
2korden at gmail.com
Mon Nov 16 01:55:25 PST 2009
On Mon, 16 Nov 2009 12:48:09 +0300, MIURA Masahiro <echochamber at gmail.com>
wrote:
> On 11/16/2009 06:16 PM, Denis Koroskin wrote:
>>> If I remember correctly, one of D's design policies is
>>> that a D code that looks like C code should behave like C.
>>> Are we giving up that policy?
>> Correction: either behave like C, or raise a compile-time error.
>
> Yes. I should have written "a valid D code".
>
>> Missing break statement will not cause a different behavior. It will
>> fail to compile.
>
> Could you clarify? In you proposal, does a break statement
> breaks out of the switch? Then,
>
> for (;;) {
> switch (foo) {
> case "FOO":
> break;
> }
> }
>
> In C, 'break' exits the for-loop. In your proposal, it doesn't.
Either I don't know C, or it breaks the switch, not the for-loop. In both
languages. Before *and* after the proposed change.
There was no suggestion to remove breaks and make them implicit. The
proposal was to make code flow control statements mandatory (either of
break, return or goto).
More information about the Digitalmars-d
mailing list