3 ms·
>Go To Statement Considered Harmful” (1968) – Edsger Dijkstra This is outdated and does not apply to modern goto. It is often misunderstood which causes peopl
by high_na_euv 2y ago
>Go To Statement Considered Harmful” (1968) – Edsger Dijkstra
This is outdated and does not apply to modern goto.
It is often misunderstood which causes people to avoid goto even when it is very valid, even better than alternatives solution
- chris12321 2y agoHow does a modern goto differ from a traditional goto?
- Sharlin 2y ago"Modern" goto (well, there aren't many modern languages with goto, but anyway) is semi-structured. Most importantly, it's local: you cannot jump into or out of subroutines, which was Dijkstra's major peeve. Using goto for backwards jumps is also usually discouraged post-Dijkstra.
- psychoslave 2y agoTo my understanding, the underlying issue is the way to structure code in a maintenance friendly way. It’s just very easy to go awry with unrestricted wild goto. There are more often than not some alternatives control flows which are easier to mentally follow. And things like label in Java[1] already capture most of relevant cases in which a generic goto statements might feel like a valid approach. This doesn’t mean that there is absolutely no case where a goto might be the most elegant easiest way to implement something, but that few cases are exceptional. I mean, no one feels like using a laser is a proper way to cut butter, but using lasers is sometime the best cutting accurate option. [1] https://www.geeksforgeeks.org/g-fact-64/ https://www.geeksforgeeks.org/g-fact-64/