Friday, June 26, 2009
I Miss C-Style Switch Statements
It took me about a year to fully warm up to C# after years of unmanaged C++ in the COM/Win32 world. Now I'm at a point where I love it. But there is one thing about it that drives me nuts: Microsoft no longer lets you have "fall-through" control transfer between case clauses inside a switch statement. You have to have every case paired with an explicit break, even if it doesn't make logical sense. This means that now I have to do a lot of if...else if...else if...else-type constructions to get the desired control flow, when a C-style switch statement would've been the most elegant thing. *sigh*
Subscribe to:
Post Comments (Atom)
4 comments:
Some write-ups I've read stated that Microsoft imposed this because of the large number of bugs caused by people forgoting to insert the break statement. Pity, because even Java allows for the fall-through logic. Joe Hafeman
Yes, Peter!!! We can see the lake. The water is here!!!!
Remember. It's not what you say, it's how you say it. Botox always wins the beer contest. Every goddamn time. And the mountain slides into the sea. Cheers!
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Post a Comment