3 ms·
In my opinion, the only problem in using goto is that it isn't contained. Loops, functions, if-then-else and switch-case statements all have clear bounds, but w
by TallGuyShort 17y ago
In my opinion, the only problem in using goto is that it isn't contained. Loops, functions, if-then-else and switch-case statements all have clear bounds, but with goto it is very easy to start forming spaghetti code.
There are times I wish I could use a goto in my code, but decide against it purely because I know it will be criticized by everyone else (or perhaps worse - used as justification for using goto in some other location)
- scott_s 17y agoThat's the same argument Dijkstra made.
- edw519 17y ago"...with goto it is very easy to start forming spaghetti code." Exactly! Spaghetti code doesn't spontaneously occur. It happens slowly but surely, year after year, one quick fix at a time. The odds against it are much better if the goto cherry is never popped. "...purely because I know it will be criticized by everyone else..." And also because you know better ;-)
- scott_s 17y agoExcept, as Dijkstra pointed out 40 years ago, and the discussion in the article supports, there are places where gotos are best practice.