0292: "Goto"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

frostyservant
Posts: 6
Joined: Thu May 03, 2007 3:48 am UTC

Postby frostyservant » Fri Jul 20, 2007 7:47 am UTC

A programming pet-peeve and a Cryptonomicon reference in one strip?

Simply put: Randall Munroe, you are god.

User avatar
FiddleMath
Posts: 245
Joined: Wed Oct 11, 2006 7:46 am UTC
Location: Madison, WI
Contact:

Postby FiddleMath » Fri Jul 20, 2007 7:49 am UTC

e946 wrote:I used 3 or 4 gotos in my most recent program. Am I going to die?


No, as you're already dead. Call a priest, cleric, or someone similarly qualified to put the dead at their ease. In the meantime, make sure you keep any bits that fall off.

Of course, if you used those gotos willingly, then you'd better make sure to call an evil priest. Otherwise, the banishment might sting, a bit.

User avatar
kibiz0r
Posts: 11
Joined: Tue Apr 24, 2007 7:42 pm UTC
Location: In your base, killing your mans
Contact:

Postby kibiz0r » Fri Jul 20, 2007 8:15 am UTC

To quote the great LordBob of allegro.cc:

Goto is the buldozer of coding. Sometimes, the buldozer is just the right tool for the job. Not often, but sometimes.
This post has been modified from its original version. It has been formatted to fit your mind.

User avatar
noouch
Posts: 132
Joined: Mon Jul 16, 2007 11:32 am UTC
Contact:

Postby noouch » Fri Jul 20, 2007 8:37 am UTC

"Do. Not. Use. Goto. In. C."

Was one of the first things I was taught.
I still don't know why, really...

User avatar
2DMan
Posts: 156
Joined: Wed Jul 18, 2007 1:49 pm UTC
Location: Suffolk, England (or Sheffield, during semesters)

Postby 2DMan » Fri Jul 20, 2007 9:37 am UTC

I have pretty limited experience with GOTO (my coding knowledge is Java, which is all they teach in the first year at my uni, and Java doesn't have GOTO to my knowledge). However, I have still been very specifically taught not to use it should I get the opportunity. Given how hacked-together my code is anyway, one less possible mistake is probably a good thing. I really need to learn not to write code using a stream-of-consciousness technique...

Also, the comic is the win, but I admit I didn't get the Alt-text 'cause I haven't read Cryptonomicon. Is it good?
2DMan - Master of Calm
Also known as 'TwoDaemon' on the IRC, with thanks to LE4dGOLEM.

Jivlain
Posts: 6
Joined: Fri Jul 20, 2007 9:49 am UTC
Location: Australia
Contact:

Postby Jivlain » Fri Jul 20, 2007 9:52 am UTC

Randall, are you peering into my mind and feeding on the guilty thoughts?

I used a goto in some C program I was writing the other day. I compiled it. I ran it. It worked.

And then I felt so guilty that I restructed the code instead.

User avatar
Rekcah
Posts: 3
Joined: Fri Jul 20, 2007 9:38 am UTC

Postby Rekcah » Fri Jul 20, 2007 9:59 am UTC

Disappointed in this one.

While I personally avoid them, 'goto' statements really aren't a bad thing, just as 'global variables' really aren't a bad thing. The big complaint about these two things is that they lead to the horrific 'spaghetti code'. In reality, though, there are times when global variables and goto statements would actually help clarify code.

The finished product (assuming a good compilier) should be no different. It all gets crunched into a bunch of 'call's and 'jmp's in the end (okay... maybe '1's and '0's in the end... but you get the point).

For whatever reason the idea that these are bad has persisted through inculcation. I heard it throughout high school and in every CS class in college. My teachers and professors heard it through their teachers and professors. Now it's just something "everyone knows": goto and global variables are _BAD_, just no one really knows why.

And yet knowing this, I still avoid them. We're incorrigible.

P.S. Hello forums!

User avatar
Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

Postby Strilanc » Fri Jul 20, 2007 11:40 am UTC

Goto is really only a problem when you
- Jump backwards in code instead of forward
- Jump into a loop from outside of it
- Have more than a couple

I think requiring a block format similar to try-catch could be used for many remaining 'good' cases of goto. For example:

Code: Select all

jump {
  ...code
  if (rarelyhappens) then
    fallto raptorattack;
  ...code
  break;
} land doubleraptorattack {
  ...code
  //falls through to raptor attack
} land raptorattack {
  ...code
  break;
} land carebearattack {
  ...code
}


But, of course, this would add more indentation to code. Some people don't like over-indenting.
Don't pay attention to this signature, it's contradictory.

User avatar
redthegreat
Posts: 177
Joined: Thu Jul 19, 2007 2:32 am UTC
Location: Guernsey CI
Contact:

Postby redthegreat » Fri Jul 20, 2007 11:55 am UTC

Anyone else notice how much this raptor looks like Tyrannosaurus Allan?

http://www.youtube.com/watch?v=vaaxtxkJqKg

User avatar
Agent Anderson
Posts: 25
Joined: Mon May 21, 2007 11:44 am UTC

Postby Agent Anderson » Fri Jul 20, 2007 12:03 pm UTC

Well-structured programming is becoming more and more difficult for me since I'm working in MS ASP.NET and am trying to make a web app work in both IE and Firefox.

Trend I'm noticing in my work: (quality of page) = 1/(quality of code)

Rangsk
Posts: 4
Joined: Fri Jul 20, 2007 11:29 am UTC

Postby Rangsk » Fri Jul 20, 2007 12:13 pm UTC

I find it surprising that people take for granted that goto and global variables are things to be avoided, especially in languages like C++, but have never really put thought into why. I have actually given it a lot of thought, and here's what I have come up with.

I'll deal with goto and global variables separately, because they really are separate concepts and shouldn't be clumped together.

goto:
The first reaction from anyone who actually knows how programming works is that it shouldn't matter if goto is used. The code is compiled to assembly/machine code, and at that point all control statements become jumps anyway. However, the whole point of programming is to add an easy to understand layer of abstraction above assembly. Jumps belong in assembly, not in high level languages.

The goto statement defies scope and confuses language rules. A common temptation is to do something like this:

Code: Select all

for (int x=0; x<10; x++)
    for (int y=0; y<10; y++)
        if (!CallFunc(x,y)) goto end_early;

end_early:


Using the goto here is a tempting way to leave both for loop scopes simultaneously. But now new problems have been introduced. Labels have to match for loops and labels have to be unique. If used enough, the code ends up with end_early1, end_early2, etc. Now new code is inserted somewhere inbetween. The programmer has to keep track of all these labels, and multiple people who may be working on the code need to make sure not to collide with other labels. It becomes a huge mess. Compilers will automatically keep track of this stuff, but only if you actually use high level concepts!

Another problem is that because gotos completely ignore the concept of scoping, it causes readability issues, and can easily cause buggy code that's hard to track down. Here's something that could easily happen to this code:

Code: Select all

for (int x=0; x<10; x++)
    for (int y=0; y<10; y++)
        if (!CallFunc(x,y)) goto end_early;

int finished = 0;
end_early:
DoSomethingWith(finished);


Looking at this code, without knowing the semantics of the language I'm currently using, I have no idea if finished will always get initialized to 0, will be uninitialized if I jump to end_early, or won't be in scope because I didn't hit the line of code that declared it. High level languages are supposed to be clear and readable. This case seems quite fuzzy and up to the semantics of the language.

Just for the record, here are a few possibilities to avoid this goto:

Code: Select all

for (int x=0; x<10; x++)
{
    bool EndEarly = false;
    for (int y=0; y<10; y++)
    {
        if (!CallFunc(x,y))
        {
            EndEarly = true;
            break;
        }
    }
    if (EndEarly)
        break;
}


Or something that I would consider a little messier, but avoids the extra condition in the outer for loop:

Code: Select all

bool EndEarly = false;
for (int x=0; x<10 && !EndEarly; x++)
{
    for (int y=0; y<10; y++)
    {
        if (!CallFunc(x,y))
        {
            EndEarly = true;
            break;
        }
    }
}


The advantage of my first example especially is that it uses the scoping rules to allow this code to be put all over the place without worrying about touching anyone else's names. Even if they have a variable named EndEarly, it will be overrided by the one within the for loop scope, but just for that scope. This is much better than having to create some kind of wiki database of label names for your project.

Global variables:
The most obvious argument against using global variables is the inevitable naming conflict. Linker errors anyone? Your global named "gX" is just a disaster waiting to happen. The larger the project and the more people using the project, the more important it is to prevent programmers from creating these conflicts.

Slightly less obvious is that globals have to be declared two or more times to be really useful. Once in an arbitrary cpp file where it actually resides, and externed in all the other cpp files where it's used. If one of the types changes, you better hope you remember to change it everywhere else that it's externed, because externs are by name only and are not type checked! You also better hope that all programs that use these files use the one that actually contains the global's definition. If you aren't using the global in more than one file, please at least use the "static" keyword, which makes it scoped to just that file.

Another reason often cited is that when reading code, it is very often unclear where a variable comes from. And when it's an externed global, it compounds the problem ten fold.

However, I think the most compelling reason to not use globals is that they have no specified attachment to any code. Globals are only useful to the code that uses those globals, and yet any code anywhere can use them. Globals are usually just programmers being too lazy to actually group the data with the actions on that data, such as in structs or classes. There is no abstraction of concept. If functionality stays the same, but implementation changes, then those globals have to change too, and all functions that use those globals have to change. You'd better hope you're happy with your global variable names the first time you write the code.

Just my ramblings, but I hope this gives some insight into why these things were shunned from high level programming so long ago.

User avatar
Silverbolt
Posts: 91
Joined: Fri Mar 02, 2007 7:56 pm UTC
Location: The Outer Realm of Romania
Contact:

Postby Silverbolt » Fri Jul 20, 2007 12:15 pm UTC

Bwahahahaha! So THIS is why they told us not to use GO TO. Not that bullshit about "structured/unstructured" programming. It all makes sense now :D
One day I will bring peace to the world with my invincible Army of Mice
Cheap Rip-Off Comics Inc.

User avatar
WhiteRabbit
Railgun of Infinite Patience
Posts: 242
Joined: Fri Oct 20, 2006 2:30 pm UTC
Contact:

Postby WhiteRabbit » Fri Jul 20, 2007 12:49 pm UTC

I now desperately need to find a legit use of goto in the code that I am writing so I can use a dengo label.
For the Jihad

gremio
Posts: 1
Joined: Fri Jul 20, 2007 12:17 pm UTC
Location: Cambridge, Massachusetts, United States

Continuations!

Postby gremio » Fri Jul 20, 2007 12:53 pm UTC

So the reason people even think about gotos is because they work in languages without continuations.

Gotos are a poor choice for exception handling because you have to know where the exception is going to be handled at the site where you detect it, and there can be one and only one handler. Ugh.

Continuations capture the desired handler, and can be passed to the place where you detect the error -- they are how try/catch work under the hood.

And by making continuations explicit, you can do so many amazing things!

Back to writing test cases,
Grem
Last edited by gremio on Fri Jul 20, 2007 1:10 pm UTC, edited 2 times in total.

Cyberax
Posts: 27
Joined: Wed May 02, 2007 7:31 am UTC

Postby Cyberax » Fri Jul 20, 2007 12:53 pm UTC

As my friend said: "That's how Gotozilla looks like, I only wish there'd be Cuzilla and Pastezilla".

BTW, "goto" is OK in plain C for error handling: "goto error_exit".

User avatar
Devilsaur
Posts: 306
Joined: Wed Jul 18, 2007 4:45 am UTC

Postby Devilsaur » Fri Jul 20, 2007 12:58 pm UTC

This comic is made of so much win! I think I've found another favourite :D

Fortunately, I've never been tempted to use goto commands (cheats) because I didn't start on basic and thus never became addicted to this bad bad shortcut.

However, I've been taught that breaks, when they aren't required, (ie. not with switch cases in c++), are bad programming style. Because when I started coding, I was told they shouldn't be required if you've set up preconditions and exit conditions for loops and program flow correctly.

So to this day I cringe and hate myself whenever I use a break. I'd rather put it four more comparisons and get a nasty horizontal length then use a break =p

User avatar
Toeofdoom
The (Male) Skeleton Guitarist
Posts: 3446
Joined: Wed Jan 10, 2007 10:06 am UTC
Location: Melbourne, Australia
Contact:

Postby Toeofdoom » Fri Jul 20, 2007 1:02 pm UTC

I only ever used gotos to make infinite loops on my ti-83.

Brilliant comic anyway.
Hawknc wrote:Gotta love our political choices here - you can pick the unionised socially conservative party, or the free-market even more socially conservative party. Oh who to vote for…I don't know, I think I'll just flip a coin and hope it explodes and kills me.

Website

User avatar
warhorse
Posts: 203
Joined: Fri Mar 09, 2007 6:42 pm UTC
Location: Möbius Strip
Contact:

Postby warhorse » Fri Jul 20, 2007 1:19 pm UTC

In my experience, the only valid use for goto is for cleanup work. If I'm in a function that is initializing a bunch of stuff, I'll have all of the cleanup in reverse order at the end of the function. Then, if any of the initialization fails, I'll goto the appropriate part of the cleanup block so that only the stuff that has been initted gets deinitted.

We use this at work in our C code and this is the only situation in which I would use a goto.
It's OK to be social, just don't tell anyone about it.

User avatar
Sprocket
Seymour
Posts: 5951
Joined: Mon Mar 26, 2007 6:04 pm UTC
Location: impaled on Beck's boney hips.
Contact:

Postby Sprocket » Fri Jul 20, 2007 1:35 pm UTC

Dr. Venture wrote:Raptors! Always around every corner, just waiting for you to drop your guard.

Learning that real Velociraptors were small and covered in feathers saddened me.
I don't feel like that's a knowledge, that's one of those "considering we think they're related to brids, it might make sense if they were covered in feathers...I'm gonna go with that..." it's not a fact or nuthin. It's like the warm blooded/cold blooded debate. It's hard to see how a cold blooded animal could be that huge, nar impossible, but a lot of scientists just thought it was the case back in the day.

You should all listen to Royksopp
Last edited by Sprocket on Fri Jul 20, 2007 1:38 pm UTC, edited 1 time in total.
"She’s a free spirit, a wind-rider, she’s at one with nature, and walks with the kodama eidolons”
Image
Image
Image
Image
Image
Zohar wrote: Down with the hipster binary! It's a SPECTRUM!

User avatar
Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

Postby Strilanc » Fri Jul 20, 2007 1:38 pm UTC

Rangsk wrote:words...


Using a boolean flag to break out of a loop is UGLY and shouldn't be necessary. This is why I wish more languages allowed you to break out of more than one loop (eg. break(2)). Future programmers might move the check around, but checking for that flag has to be done immediately after the inner loop. In effect, giving you a similar issue to what goto does!
Don't pay attention to this signature, it's contradictory.

ehiunno
Posts: 220
Joined: Mon Jun 25, 2007 3:46 pm UTC
Location: NN, VA
Contact:

Postby ehiunno » Fri Jul 20, 2007 1:46 pm UTC

haha, looking at the last bit of code I wrote in PBASIC, I realize that I used goto's all over the place. Its really short code though, and thats mostly for subroutines.

Actually, I didn't even know it was bad coding practice, but I was never taught to code. I was always of the "if it works, word" coding practice. Hopefully I will learn to code well at college.

catchy5
Posts: 2
Joined: Fri Jul 20, 2007 1:28 pm UTC

Postby catchy5 » Fri Jul 20, 2007 1:52 pm UTC

When a professor says "Never use a goto!!!", to me that says that they really do not have that much experience in real-world coding, or they are just plain ignorant. Certainly, using goto's are not the norm, but to make that statement without providing the true pros/cons of its use is ridiculous. I would just prefer if they said something like, "Goto statements should not be used to save time, or because you are lazy! There are cases where they are useful, but should be used with caution, as they prevent the compiler from using regular block checks and rules." Obviously, an intro to C course will not require its use, but as I can see from this forum, almost everyone still believes that they are completely evil.

As a firmware developer, there are times when using a goto will actually make the code much easier to understand, however it is not often. Error cleanup is a great example of when this is used, as mentioned by warhorse.

Also, as others have mentioned, the compiler will optimize the code so that goto's will behave almost the same as if you used regular blocking. However, there are times when each clock tick is very important, and extremely tight performance loops may require the use of a goto... although, if it is that much of a concern, we usually default to ASM in those cases anyway.

dskippy
Posts: 30
Joined: Wed May 16, 2007 5:48 pm UTC
Location: Somerville, MA
Contact:

Postby dskippy » Fri Jul 20, 2007 2:10 pm UTC

Wow. I didn't know Dijkstra has a velociraptor costume.

-mike

User avatar
entropomorphic
Posts: 23
Joined: Mon Apr 02, 2007 2:51 pm UTC

Postby entropomorphic » Fri Jul 20, 2007 2:11 pm UTC

Goto Dengo had one of the best lines in Cryptonomicon... something like...
Dengo said, "I am going to swim to New Guinea," and he did.


I make myself forget that goto is even a legal statement in C/C++, and I always think it looks out of place when I see it in other people's code. I don't miss it at all. A better way to handle exceptions is

Code: Select all

do {
  if(exception) {
    break;
  }
} while(false);


Using gotos can break you out of multiple blocks, which seems like it would be useful but it's more likely to make you skip necessary steps.

Some 'Splainin' to Do
Posts: 16
Joined: Fri Jul 20, 2007 2:05 pm UTC
Contact:

Postby Some 'Splainin' to Do » Fri Jul 20, 2007 2:14 pm UTC

saxything43 wrote:*sigh* I think I'm going to have to get my hacker girlfriend to teach me coding from ground zero. Otherwise, I'll never catch up with you guys. I mean, this comic made ZERO sense to me because I don't know anything about codes....:( I have a lot of work ahead of me.


Well, basically, a GOTO statement is a way to jump from one part of a program to another. Newbie programmers love GOTO statements because it's a fairly intuitive and easy to do operation. More experienced programmers despise it because it results in something called spaghetti code, which means that the logic of the code can become very difficult to untangle which is especially bad in a professional environment where other people are going to have to support your code, especially if you leave the company and are no longer available to explain it.

The preferred method is to use block code where the various things that the program does are laid out in logical blocks. You then have the program make calls to those various blocks when do their thing and then return you to where you were at in the program. This is much, much easier to support (to say nothing of debugging).

The antipathy that experienced programmers have for GOTOs is often conveyed in very dire terms to new programmers, hence the joke.

Hope that helps.

User avatar
space_raptor
Posts: 1497
Joined: Fri Nov 17, 2006 5:02 pm UTC
Location: Calgary
Contact:

Postby space_raptor » Fri Jul 20, 2007 2:14 pm UTC

Anyone learning to code should not use gotos, because you will not learn how to structure a program correctly. Most assignments/projects a student does are probably designed such that there is no way a student should use gotos.

Global variables, on the other hand, can be awesomely efficient. You just have to make sure that you actually want them to be global. I have achieved great success with global variables. I am not ashamed, either.
The drinking will continue until morale improves.

elminster
Posts: 1560
Joined: Mon Feb 26, 2007 1:56 pm UTC
Location: London, UK, Dimensions 1 to 42.
Contact:

Postby elminster » Fri Jul 20, 2007 2:16 pm UTC

I was once working on some code for a private game server, it had about 400k lines, originally written by koreans. It was buggy as hell, very poorly structured and among another things i came across at least 40 uses of goto... my first reaction was "Oh me yarm, its hideous!". I ended up rewriting immense amounts just for structure, readability (some bugs took a few 1000 lines of reading to just understand what they did, certainly not clear) and future updates.

Raptors have good reason to attack with unneeded usage of goto.

p.s. Also dont use globals when isnt needed, can also lead to problems.
Image

Some 'Splainin' to Do
Posts: 16
Joined: Fri Jul 20, 2007 2:05 pm UTC
Contact:

Postby Some 'Splainin' to Do » Fri Jul 20, 2007 2:21 pm UTC

CatProximity wrote:
Dr. Venture wrote:Raptors! Always around every corner, just waiting for you to drop your guard.

Learning that real Velociraptors were small and covered in feathers saddened me.
I don't feel like that's a knowledge, that's one of those "considering we think they're related to brids, it might make sense if they were covered in feathers...I'm gonna go with that..." it's not a fact or nuthin.


Hmm, we've found dino imprints with feathers (including baby T-rexi!) so it's more than just idle speculation. I don't know whether or not velociraptors imprints have been found, however.

That said, it is a fact that real velociraptors were about the size of terriers, nor did they have big brains (hence, no reason to suppose that they were the genius animals depicted).

The Jurassic Park books have really distorted the public perception of those animals. That said, there were plenty of larger raptors (Utahraptor would have been able to look an NBA basketball player in the eye) that could fill in for the role.

User avatar
Belial
A terrible sound heard from a distance
Posts: 30450
Joined: Sat Apr 15, 2006 4:04 am UTC
Contact:

Postby Belial » Fri Jul 20, 2007 2:28 pm UTC

Some 'Splainin' to Do wrote:
CatProximity wrote:
Dr. Venture wrote:Raptors! Always around every corner, just waiting for you to drop your guard.

Learning that real Velociraptors were small and covered in feathers saddened me.
I don't feel like that's a knowledge, that's one of those "considering we think they're related to brids, it might make sense if they were covered in feathers...I'm gonna go with that..." it's not a fact or nuthin.


Hmm, we've found dino imprints with feathers (including baby T-rexi!) so it's more than just idle speculation. I don't know whether or not velociraptors imprints have been found, however.


I believe they have, actually.

That said, it is a fact that real velociraptors were about the size of terriers, nor did they have big brains (hence, no reason to suppose that they were the genius animals depicted).

The Jurassic Park books have really distorted the public perception of those animals. That said, there were plenty of larger raptors (Utahraptor would have been able to look an NBA basketball player in the eye) that could fill in for the role.


Intentional Obfuscation of Language Warning: Many people, when speaking of larger dromaesaur species like Deinonychus and Utahraptor in common conversation, will refer to them as "velociraptor".

This is not necessarily an *error* per se, so much as it's an intentional rebranding. Simply put, "Velociraptor" is a much cooler name than either of the alternatives, and those little terrier-sized demon-pigeon fuckers don't deserve it.

Meanwhile, "Utahraptor" puts one in mind of polygamous reptiles wearing sacred undergarments and bicycling door-to-door.

We know we're not using the right names. But these names are better.
addams wrote:A drunk neighbor is better than a sober Belial.


They/them

UltramaticOrange
Posts: 45
Joined: Wed May 30, 2007 3:31 am UTC
Contact:

Postby UltramaticOrange » Fri Jul 20, 2007 2:34 pm UTC

Reminds me of a programming assignment I had to write in college as part of my Programming Languages class. In ANSI Standard C, I had to write quicksort (and subsequently, a stack) using nothing but goto statements. The only time I was allowed an 'if' statement was when it was immediately followed by a goto. No loops, and no recursion. I miss REAL programming like that (please not that I'm not saying that 'goto' is 'real programming' but rather the level of complexity and the fact that it was C made it 'real'). Stupid VB6. your mother was a hamster and your father smelt of elderberries. /action smacks lips.
Last edited by UltramaticOrange on Fri Jul 20, 2007 2:49 pm UTC, edited 3 times in total.
Image

User avatar
frezik
Posts: 1336
Joined: Wed Jan 10, 2007 7:52 pm UTC
Location: Schrödinger's Box

Postby frezik » Fri Jul 20, 2007 2:36 pm UTC

jamesh wrote:
Peripatetic wrote:Funny enough, the Linux kernel actually makes frequent use of goto.

http://kerneltrap.org/node/553/2131

Linus himself defends the practice here. Maybe that's why he's so irritable; he's constantly fending off raptors.


If you are programming in C, proper use of gotos can lead to code that is both more reliable and more readable. In situations where you'd use a try/finally structure in other languages, gotos can provide similar control flow in C.


That's not why they're in the Linux kernel. It's because GCC happens to compile gotos very efficiently, and there are many places where a kernel must be as fast as possible.

I don't think this true anymore, but legacy code remains. It was certainly true around the linux 2.2 days.

2DMan wrote:I have pretty limited experience with GOTO (my coding knowledge is Java, which is all they teach in the first year at my uni, and Java doesn't have GOTO to my knowledge).


Java has goto as a reserved word, but it does nothing.

Devilsaur wrote:However, I've been taught that breaks, when they aren't required, (ie. not with switch cases in c++), are bad programming style.


This is the opinion of Computer Scientists that lean highly on theory rather than practice (such as Wirth), whereas Dijkstra showed that goto is bad in both theory and practice. It's been shown that in practice, using control constructs in loops tends to be more straightforward and easier to write correctly than the alternatives.
Last edited by frezik on Fri Jul 20, 2007 2:50 pm UTC, edited 1 time in total.

User avatar
Hench
Porn, hence, Man
Posts: 498
Joined: Wed Mar 28, 2007 4:16 pm UTC
Location: Right between my eyes
Contact:

Postby Hench » Fri Jul 20, 2007 2:38 pm UTC

Belial wrote:We know we're not using the right names. But these names are better.


The great thing about language is that it only works when everyone agrees on it.
Spoiler:
Your perceptions will not change reality, but simply color it.

User avatar
Tractor
Posts: 2467
Joined: Mon Jan 08, 2007 6:17 pm UTC
Location: no

Postby Tractor » Fri Jul 20, 2007 2:40 pm UTC

Blah GOTOs. I cannot thing of any times where I've resorted to using them.

However, a couple years ago, I inherited a large VB project that was littered with them. As if trying to figure out the generic flow of a large program wasn't bad enough, they had to throw that in there too. Bastards.
9 x 6 = 42

Note: Randall kicks ass.

UltramaticOrange
Posts: 45
Joined: Wed May 30, 2007 3:31 am UTC
Contact:

Postby UltramaticOrange » Fri Jul 20, 2007 2:45 pm UTC

Tractor wrote:Blah GOTOs. I cannot thing of any times where I've resorted to using them.

However, a couple years ago, I inherited a large VB project that was littered with them. As if trying to figure out the generic flow of a large program wasn't bad enough, they had to throw that in there too. Bastards.


mmm. and not to mention that you've got to LOVE that "on error goto shit" error handling syntax because, ya'know, THAT was a good idea.
Image

User avatar
Belial
A terrible sound heard from a distance
Posts: 30450
Joined: Sat Apr 15, 2006 4:04 am UTC
Contact:

Postby Belial » Fri Jul 20, 2007 2:45 pm UTC

Hench wrote:
Belial wrote:We know we're not using the right names. But these names are better.


The great thing about language is that it only works when everyone agrees on it.


Yes. And most of us have agreed that velociraptors were the things in Jurassic Park.

Yes, those were actually utahraptors, but screw you, hippy.
addams wrote:A drunk neighbor is better than a sober Belial.


They/them

Ilyanep
Posts: 7
Joined: Fri Jul 20, 2007 2:50 pm UTC

Postby Ilyanep » Fri Jul 20, 2007 2:53 pm UTC

So I've been programming ever since I dabbled around with batch files and then C++ back when I was like 8 years old [only 7 years ago...], and the only time I've ever used a goto statement is in MS-DOS batch.

Yes I registered just to say that. Been reading XKCD for almost a year now and I finally decided to register...
DarkLordFoxx Media

(if random.Next(10) > 5) { post.insert(badProgrammingJoke); }

User avatar
Hench
Porn, hence, Man
Posts: 498
Joined: Wed Mar 28, 2007 4:16 pm UTC
Location: Right between my eyes
Contact:

Postby Hench » Fri Jul 20, 2007 2:55 pm UTC

Belial wrote:
Hench wrote:
Belial wrote:We know we're not using the right names. But these names are better.


The great thing about language is that it only works when everyone agrees on it.


Yes. And most of us have agreed that velociraptors were the things in Jurassic Park.

Yes, those were actually utahraptors, but screw you, hippy.


No, no, you misunderstand. I agree with you.

And I, for one, welcome our new (veloci)raptor overlords.
Spoiler:
Your perceptions will not change reality, but simply color it.

User avatar
Sprocket
Seymour
Posts: 5951
Joined: Mon Mar 26, 2007 6:04 pm UTC
Location: impaled on Beck's boney hips.
Contact:

Postby Sprocket » Fri Jul 20, 2007 2:57 pm UTC

After a discussion I came to the potential conclusion that for the purpose of executing this goto joke, Munroe chose to use velociraptors, which are his go-to joke.

Man, I don't know, last I checked feathers were still speculation (these kind of look like feather imprints...but maybe they're not.) was still sort of the thing, but I haven't been up on anything really in years, except when it was determined that one fossil of......some dinosaur I can't recall...with feather imprints had been completely faked.
Last edited by Sprocket on Fri Jul 20, 2007 3:01 pm UTC, edited 1 time in total.
"She’s a free spirit, a wind-rider, she’s at one with nature, and walks with the kodama eidolons”
Image
Image
Image
Image
Image
Zohar wrote: Down with the hipster binary! It's a SPECTRUM!

User avatar
Belial
A terrible sound heard from a distance
Posts: 30450
Joined: Sat Apr 15, 2006 4:04 am UTC
Contact:

Postby Belial » Fri Jul 20, 2007 2:58 pm UTC

Hench wrote:No, no, you misunderstand. I agree with you.



OHHHhhhh!

Carry on, then.
addams wrote:A drunk neighbor is better than a sober Belial.


They/them

scwizard
Posts: 519
Joined: Sun Mar 04, 2007 6:29 pm UTC
Location: New York City
Contact:

Postby scwizard » Fri Jul 20, 2007 3:15 pm UTC

e946 wrote:I used 3 or 4 gotos in my most recent program. Am I going to die?

If you've wasted time asking that question instead of arming yourself then yes, your going to die.
~= scwizard =~


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: drazen, speising and 106 guests