|
If one doesn't understand the lack of need for the 'goto' except in exceptional circumstances (I use the term, exceptional, advisedly), one doesn't understand programming. The normal path of a program is a logical progression from one point to another. Ocassionally a side trip is needed. Conditional statements provide for that. Ocassionally a tool or utility or object (and its methods) are needed. One calls upon them. The normal state of affairs is such that those called-upon adjuncts do their thangy and then return to the point at which they were invoked. Things roll along, things get done. Fatal errors can happen; errors which have no bearing on the point at which the program is operating, or only a minor relationship. Drastic measures may be called for. Modern language writers provide for that. 'Goto' wasn't their vehicle. Older languages require more than ordinary skills to deal with the problem if it's recalcitrant enough. One pulls out the wand and gets the rabbit from the hat. The rabbit may have goto-looking ears, but it's certainly not a given. I've never used a goto in C or C++. Why? If I'm in that kind of trouble, I'm usually under the hood finagling registers and the stack. Bad boy, bad boy, whatcha gonna do?
|