Switch and break

Matej Nanut matejnanut at gmail.com
Thu Jan 19 16:03:21 PST 2012


On 20 January 2012 00:46, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Thursday, January 19, 2012 22:10:19 Peter Alexander wrote:
>> 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.
>
> I'd be _very_ annoying if you couldn't do fall-through with switch-statements.
> That's a major feature and important for case statements IMHO. However, making
> fallthrough be explicit as D now does (with -w anyway) is definitely an
> improvement.
>
> - Jonathan M Davis

I like the error DMD (-w) gives in this situation a lot. It has saved
me precious minutes of debugging on more than one occasion. :)

And I never liked ‘warning:’s anyway. If something is dangerous enough
to warrant a warning, the compiler may just as well enforce it in the
language and be done with it.

Matej


More information about the Digitalmars-d-learn mailing list