Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting to see that they don't shy away from using goto in their code.

http://roslyn.codeplex.com/SourceControl/latest#Src/Compiler...

Something I've just learned from looking at the code is you can jump between cases in a switch statement :

    switch (a) {
       case '1':
         ...
       case '2':
         goto case '1';
    }
 
Never realised you could do that.


Sometimes you even have to, because fall-through is illegal in C# except with empty case labels. goto case makes things more explicit.

Although there is no reason why they wouldn't use goto. The oft-cited "goto statement considered harmful" was in a very different context and basically just ranted against using goto when there are control structures that make intent clearer.


You can even jump back from a catch or finally handler to the try block ;) At least in MSIL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: