On 19/01/12 9:55 PM, RenatoL wrote:
Just curious: why in D we are not obligated to use break in every
branch of a swicth structure? That is:
        switch (i)
        {
                case 1:
                writeln("You wrote 1");
                case 2:
                writeln("You wrote 2");
                case 3:
                writeln("You wrote 3");
                default:
                writeln("I said: 1 or 2 or 3!");
         }

is good in D, while, for example, similar code in C# is incorrect
and if you want to play with fall through you have to make some
trick. Again this behaviour of D seems a bit buggy, to me. Are
there design reasons?

Consistency with C and C++ mainly.

Some people find it convenient, but it is unarguably a frequent source of bugs that we could do without.

Reply via email to