Hacker News new | ask | show | jobs
by schlomie 5408 days ago
Gotos were traditionally discouraged to students since they would write code that was needlessly hard to follow (and buggy as a result), so instructing them to not use gotos improved the readability of their code and improved their thought processes.

That being said, Richard Stevens, a respected author on Unix programming, had this to say:

http://www.kohala.com/start/rstevensfaq.html Q: Why do your programs contain gotos?

Read Structured Programming with go to Statements by Knuth in the ACM Computing Surveys, Vol. 6, No. 4, Dec. 1974 issue. (In fact, this entire issue of Computing Surveys is a classic.) My challenge to the goto-less programmer is to recode tcp_input() (Chapters 27 and 28 of TCP/IPIv2) without any gotos ... without any loss of efficiency (there has to be a catch).