|
|
Back to UserFriendly Strip Comments Index
|
goto | by perldude | 2002-06-11 09:00:28 |
|
There are several cases where goto is appropriate. | by Yohimbe | 2002-06-11 09:19:09 |
|
nested structures | by perldude | 2002-06-11 09:31:02 |
| Well, assembly and machine code have no while() |
by Yohimbe |
2002-06-11 09:54:28 |
or anything like that. Its all goto's anyway. JMP is a goto. For that matter CALL is pretty well a goto, (with some stack pushing).
This fear of goto's comes from a very good but zealous article "Goto considered harmful" by Dijkstra, which attacked the style of using goto willy nilly without regard for or use of more syntactally clean structures.
And sometimes deep nested recursion can't be exited with a last and a break cleanly. You'd need extra variables to see whether a lower level had exited and such.
I still maintain that there are some code constructs where being "Proper" with last; or break; and such just gets you doing equally ugly things with status variables and tons of extra tests. I do admit that there are very few of these. For most coders, goto is a cop-out. Big time.
In the (far too) many thousand lines of perl I've coded, I've used goto LABEL exactly once. And it was a very special case.
However, in one bit of really complex C that I've bothered to get very familiar with, the vm code in linux, there are several goto's for performance. Carrying an variable around and testing it constantly would have slowed the code and made the code rather ugly. Search for "Dijkstra probably hates me" in the kernel source.
|
|
[ Reply ] |
|
Actually, I doubt that "Dijkstra hates him"... | by HadEnuf | 2002-06-11 10:22:58 |
|
Dijkstra would have killed Duff on the spot (n/t) | by Yohimbe | 2002-06-11 10:25:12 |
|
Think he would have been more justified... | by HadEnuf | 2002-06-11 10:27:18 |
|
*ow my brains* | by i_am_pi | 2006-11-19 12:55:59 |
|
Why, hello, Mr. Gumby! (n/t) | by HadEnuf | 2002-06-11 11:03:02 |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|