The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

goto by perldude2002-06-11 09:00:28
  There are several cases where goto is appropriate. by Yohimbe2002-06-11 09:19:09
    nested structures by perldude2002-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 HadEnuf2002-06-11 10:22:58
          Dijkstra would have killed Duff on the spot (n/t) by Yohimbe2002-06-11 10:25:12
            Think he would have been more justified... by HadEnuf2002-06-11 10:27:18
          *ow my brains* by i_am_pi2006-11-19 12:55:59
            Why, hello, Mr. Gumby! (n/t) by HadEnuf2002-06-11 11:03:02

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)