Very Horrible Question About Goto's
corg at copernic.com
Wed Apr 19 11:17:21 EDT 2000
> 1) the only valid use of goto's in C I've seen looks like this:
> if (bogus)
> goto cleanup
> do stuff;
> close file handles;
> do cleanup
There are, at least, two other valid uses:
1) the most important: goto's are used a lot by code generators (it
simplifies writing the generator alot in some cases)
2) in extreme cases, to improve performances.
IMHO, Goto's *are* evil in languages where you can jump around from one
function to another, but they can be useful in some cases.
My own rules are:
- don't use goto's
if you HAVE to use goto's:
- don't jump from one function to another (if your language supports it)
- don't jump backward
I was surprised to learn that Python doesn't have a goto statement.
Would it be difficult to add?
E-mail: corg at copernic.com
"Tu l'as trop écrasé, César, ce Port Salut"
More information about the Python-list