Unconditional jump instructions like GOTO are considered deprecated for several reasons:
- Complexity of control flow: Using GOTO makes program control flow much more complex and less clear, leading to code that is difficult to read, understand, and maintain over time.
- Debugging difficulties: GOTO can make debugging harder since unconditional jumps can complicate tracking program execution in a linear fashion.
- Lack of structured programming: The use of GOTO violates the principles of structured programming, which promotes control flow constructs like if-else statements, loops, and subroutines to improve code readability and maintainability.
- Potential errors: Overuse of GOTO can easily lead to programming errors, such as infinite loops or situations where parts of the code are not executed as expected.
In modern programming, many languages have removed or significantly restricted the use of GOTO to encourage safer and more structured programming practices. However, in certain very specific and controlled cases, some languages still support similar constructs.
One of the most famous critics of GOTO was
Edsger Dijkstra, a pioneer in computer science. In his famous 1968 article titled
"Go To Statement Considered Harmful", published in the
Communications of the ACM journal, Dijkstra strongly criticized the indiscriminate use of GOTO, emphasizing how it can compromise code clarity and debugging ease. This article had a significant impact on the widespread adoption of structured programming practices.
In summary, abandoning GOTO has been an important step toward writing clearer, safer, and more maintainable code in modern programming languages.