About switch case statements...
Steven Schveighoffer
schveiguy at yahoo.com
Mon Nov 16 04:03:56 PST 2009
On Mon, 16 Nov 2009 03:27:22 -0500, Don <nospam at nospam.com> wrote:
> Requiring 'goto' to implement fall-through would run into the prejudice
> against 'goto'. It's necessary to persuade managers that "goto case
> XXX;" isn't a bad, evil goto that eats babies. I have no idea if that's
> difficult or not. Otherwise, I think it's a superb solution.
> (providing that empty fall-through case statements remain valid;
> disallowing them would be really annoying).
It hasn't hurt C# at all...
http://msdn.microsoft.com/en-us/library/06tc147t(VS.80).aspx
I haven't had any issues with it. This reminds me of the != null
problem. Now if only Walter made as many mistakes with switch case
fallthrough as he did with != null :)
Walter, at some point, you should heed the complaints of the masses even
if it doesn't affect you. It's like a politician who lives in a nice
neighborhood ignoring the requests of his constituents for more police
protection in higher crime areas because he doesn't live there. Except
it's worse, because we can't vote you out :)
Also keep in mind that this does *not* change the power of switch at all,
since goto already covers fallthrough. One thing I learned from the !=
null to !is null change is that I stopped writing the offending code when
I get immediate feedback. It just gets ingrained in my brain better. So
having to write goto next_case; all the time is going to be much less of
a chore than you think, because you'll just learn to avoid that mistake in
the first place.
-Steve
More information about the Digitalmars-d
mailing list