[Mono-list] Helo in switch-case:

Miguel de Icaza miguel@ximian.com
16 Mar 2002 03:25:39 -0500

> : Even default: labels must have a break in C#, I believe.
>     On the contrast, my "break" statements are redundant. C# does not believe in
> "break" - it does it by default. This is in exactly opposite direction with what
> we have in other languages (C/C++/Java) where the flow is automatically
> transferred to next label if no break if found.
>     In C#, whether or not break is there, the control is transferred to the end
> of the block. So, applying break to default may not help.

Breaks are required as John pointed out in C# even on the default case,
because your code can look like this:

	switch (x){
		default: ...
		case 1:

>     Miguel - what implementation do we have in our mcs for this? This is going
> to be a critical point -- applying a "break" even after the last option, I mean,
> making it a total must. I hate that.

It is part of the spec, so MCS will do the same thing MS C# does. 
Currently, I do not perform any flow analysis, so you *might* get away
with not putting a final break, but that will change ;-)