Re: Funny loop with post-increment.

Jon Skeet <[email protected]> Tue, 19 Feb 2008 10:53:27 +0000
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
silky wrote:

<snip>

>>         In other places where break is used, it does something: it breaks out
>> of the block it is in, though in switch/case it's unnecessary.
>
> it is necessary given the above.

I don't think so, actually.

The language differentiates between the labels and the block of code
itself - you can have multiple switch-labels within a switch-section,
but there's no fall through from one switch-section to the next.

The compiler enforces "no fall through" by stating that it's an error
for the end of a switch-section to be reachable. It doesn't *have* to do
that. It would have been perfectly possible to define the language such
that break was unnecessary - they chose not to, that's all.

Unfortunately it's a bit too late to change that now, but I think it's
still regrettable.

Jon

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com