Re: Funny loop with post-increment.
Jon Skeet <[email protected]> Tue, 19 Feb 2008 10:13:50 +0000
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
Per Bolmstedt wrote:
>> i like the break in case statements. what is your issue with it,
>> out of interest?
>
> The usual gripes with it is that it's grammatically different from the rest
> of C# (at least in regard to comparable ways of achieving the same thing),
> and that it has non-intuitive closure/scoping behavior. Didn't Jon write
> about this in more detail recently?
I'm not sure how much detail I went into, but I certainly don't like the
handling. The variable scoping is really weird, and I think it would be
much better just to enforce braces:
switch (foo)
{
case 0:
case 1:
{
...
}
case 2:
case 3:
{
...
}
}
etc.
Jon
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com