I disagree. Perhaps I haven't tried to debug enough code with gotos in it, which I've heard is often frustrating beyond reason, but I haven't found myself agreeing to the blind slashing of goto practices. It's left in the language, and included in nearly EVERY programming language on earth for GOOD reasons!! Here and there (I think once so far) I've found a place where GOTO is the clear answer. For instance, when parsing, and checking for compliance from a string, I might use goto to specify that the string is not compliant. What are the alternatives? One might be to create a while(true){} loop, and use break; when a non-compliant situation arises (and put break; at the end). This might be endorsed by some who spit at ALL goto users without asking questions. This is not only not as clear as GOTO, but less clear, because you look at while(true) and think "Why would the fella want an infinite loop? Obviously it's not infinite, now I get to dig through and figure out what this is...oh, it's not a loop at all!! Just a goto-hack as though we don't have 'goto.'" Another response might be to `return false;' which, again, is not as good as `goto NOT_COMPLIANT'; because what's happenning is not as obvious. Also, having nested if statements ad nosium is nosiating:
bool _success = false;
if (compliant_at_char1)
{
if (compliant_at_char2)
{
if (compliant_at_char3)
{
_success = true;
}
}
}
if (_success) ...
This might be more clear than the other examples, but tedius to write, difficult to expand/improve/maintain, and hard on the eyes. There are more alternatives, but I haven't found that goto is always replaceable with the same effect.
You don't like goto, fine, don't use it, but I think it isn't advisable to advise execution (multiple times) to those who use the statement which is, again, a language feature, not only here as an overlooked feature that should have been weeded out, but one added to nearly every language today.
-Aaron