Hello,
The goto statement was once widely used. Unfortunately code that used goto extensively was poorly structured and could easily become unmanageable, and is known as "spaghetti code". Today, programming languages provide other ways to structure code so goto is rarely needed. In C++ it is always possible to use something other than goto to achieve what you need.
Note that the use of goto is a religious issue and has provoked a great deal of debate. In C++ there is always a better alternative for writing loops, so you don't need to use goto at all. There are other circumstances where goto may be more appropriate than the alternatives, though that is a seperate subject. Keep in mind when you use it to exit a block which contains aggregates requiring destructors, the destructors will run before the goto transfers control. The compiler still forbids using goto to enter a scope that requires constructors.
The indiscriminate use of goto statements has caused tangled, miserable, impossible-to-read programs. To avoid the use of goto, more sophisticated, tightly controlled looping commands have been introduced: for, while, and do-while. Using these makes programs more easily understood, and goto is generally avoided, but one might argue that the case has been a bit overstated. Like any tool, carefully used and in the right hands, goto can be a useful construct, and the ANSI committee decided to keep it in the language because it has its legitimate uses.
- Stack Overflow