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

To be fair, the example in #4 is EXACTLY WHY IT'S BAD TO USE GOTO. It's a horrible abuse of the construct that makes program flow much more difficult to follow and should have been replaced with moving some of the code off into methods.


'GOTO considered harmful' is practically biblical law amongst many programmers, but it's worth remembering that he made that statement in the context of an argument with Donald Knuth. Knuth won: ( http://web.archive.org/web/20070927094626/http://pplab.snu.a... See also http://web.archive.org/web/20051128093253/http://kerneltrap.... about goto

Good uses of goto are very rare with current programming languages. The only cases where I have found good uses were with languages that did not have exception handling and in each cases, there was some deficiencies in the specifications and the code containing the goto has disappeared with the corrected specifications. Maybe this was luck.

I still think it is ridiculous to hate goto.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: