Quote:
|
Originally Posted by KenWittlief
When you find yourself tempted to break one, its a red flag that you didnt think things through before you started writing code, or drawing schematics, or designing your logic.
|
You can't possibly understand all the different situations that come up so I don't understand how you can make blanket statements such as "it's a red flag that you didn't think things through". I would agree that any time you think you need to use a goto it should be a red flag to reevaluate the problem to make sure there isn't a better way of doing things, but I can't claim that there is never a situation where it would be appropriate. And besides, if the person writing the software hasn't thought through the program before starting, "golden rules" such as no gotos won't save him - it'll be a spaghetti-code mess either way.
I personally have never encountered a good reason to use a goto in my own work. I have, however, seen enough cases where even the best, most well-thought out designs will run into certain practical limitations that sometimes cause us to have to do things in a way that is less than ideal. This can often be the case, for example, when writing code that interacts directly with hardware. Tight timing constraints or poorly-done hardware interfaces (on external chips) can put you in a corner where a nice elegant software design just won't work. This tells me that there most likely are cases that I have not seen yet where the use of a goto might be justified.
(Sorry to original poster for continuing to take this tread off topic...

)