Thursday, March 22, 2007

Why, oh WHY?!?!?!

Currently I'm totally in the state of chock after finding out that C# supports GOTO statements.
To some people it's probably old news (that says more about them than me), but I just found out. Let me for the record state that the only way I found out was when looking through some code on codeproject.
I'm sure there's those that claim that cases exist where it actually makes sense to use GOTO, but oddly enough these people can usually never think of them, when asked for an example.
But even if there exists good usages, we've got to stop up and ask ourselves if it's really worth ruining such a nice language as C# for?! There is always another way!
Mr. Hejlsberg, in the future just say NO :-)


Anonymous said...

Even though no one is using the goto statement, when writing C# code, the optimizing compiler might rewrite the code and the obsfucator tools certainly does. Have you tried the reflector for C# tool on a obsfucated assembly? It is absolutely filled with goto statements, which makes it much harder to read and reverse engineer.

Dr-Wicked said...

Hi Allan.
From my side I should point your attention on unexistence in C# compiler thing like inline function (contrary to C++) so by design hard function can be unpacket in spaghetti code with labels and goto statement. This trick avoid your code search trough vt.