Alright Jow Forumsentlemen, let's get this straight. What is wrong with using goto?

Alright Jow Forumsentlemen, let's get this straight. What is wrong with using goto?

Attached: DxAlEzcX0AQh1LT.jpg (499x524, 28K)

Other urls found in this thread:

wiki.sei.cmu.edu/confluence/display/c/MEM12-C. Consider using a goto chain when leaving a function on error when using and releasing resources
eli.thegreenplace.net/2009/04/27/using-goto-for-error-handling-in-c
telusplanet.net/public/stonedan/source.txt
homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf
twitter.com/SFWRedditImages

Nothing.

Attached: 1528554237997.png (800x750, 106K)

It's good if you never plan to edit your program ever again

it's considered harmful

The fuck does that mean?

It's difficult to interpret and difficult to maintain. It's like turning a straightforward novel into a choose-your-own-adventure book

u must be a shit programmer if u need goto

It eliminates all inferences we might normally be able to make about the relationship between the location of a codepoint and the state of the stack frame when that point is reached.

try writing assembly without goto/jump

figure it out, dumbass...

It's harmful in the same way giving a kid a gun and some liquor is harmful, but as a mature intelligent adult it's not an issue.

Florida Man smacks your logic on the ass. What do you do?

>tfw you use a goto to escape nested loops

Attached: 1450134641980.png (310x285, 101K)

This is an acceptable use of goto but it's better to just use a multi-break statement in languages that support them

Ahhhhh goto sure takes me back to programmng text-based games on my TI calculator in 5th grade

Because it allows for breach of control flow and isnt as easy for compilers to optimize for you.

>What is wrong with using goto?
Nothing, in fact loop/switches statements, and procedures are bloat meant to dumb down the language for brainlets like the ones featured in this thread. And it also makes shorter code but none are necessary and people who say they are orange man bad are mentally deficient.

only reason I'd ever use it

Fundamentally, from an efficiency point of view, nothing. The reason "gotos are bad" is taught as a rule of thumb is because programmers these days are taught in a very abstraction-oriented way, and from that perspective, using gotos in an efficient way is not something you can reasonably expect. It's far more likely that they cause segfaults or increase code complexity/decrease readability for no reason.

wiki.sei.cmu.edu/confluence/display/c/MEM12-C. Consider using a goto chain when leaving a function on error when using and releasing resources

Manageability

Nothing. It's useful for error handling in C:
eli.thegreenplace.net/2009/04/27/using-goto-for-error-handling-in-c

What would the mechanical differences be? Does leaving a loop with goto leave anything hanging that would be caught with a break?

>not just throwing errors until someone forgets to catch it

I have always hated the actor in your pic

Attached: nM7kqct_d.jpg (640x611, 32K)

It's the same reason Linus hated C++. Goto, while very useful, is way too easy for brainlets to use. And if they use goto without knowing how to correctly use it, they create large amounts of unreadable spaghetti code.

You are now reading every post in his voice

It's hard to understand code when it's filled with goto's. Most programmers work in teams and work on long projects, which means your code has to be understandable easily when revisited and viewed by others. Sometimes goto's are necessary, such as in kernels, but those are the specialized cases.

for instance

telusplanet.net/public/stonedan/source.txt

Noone would want to touch this code with a 3-foot pole, since it's a goto-riddled mess.

You're a big guy.

Attached: f5de3b383c5aa248d9a8ab5df7a659f72e46d232e9f15b48d68973f05b0f6e69.jpg (300x681, 29K)

Try writing MS batch without goto

goto

In C for instance, the break statement only gets you out of a single loop. If you want to get out of multiple loops you either have to use return (not always desirable), set a flag and have multiple break statements checking that flag (ugly and bloated), or use a goto (based but not dijkstrapilled).

Goto is only bad if you use it in lieu of structured programming. If you just use it to hand-optimize some edge cases that don't fit neatly into a structured programming flow, then it's fine.

Having a break flag is not ugly, it is necessary.
It also scales to when you are using several threads and need to shut them all down.
As for bloat, you are optimizing the wrong thing if you have so many nested loops you need a goto statement

does Ruby even have a goto statement?

If you know what you're doing, nothing.
If you don't know what you're doing, everything.

Ruby has continuations, which are basically the same thing except that the labels to jump to (the coroutines) have to be generated at runtime and stored as data instead of being baked into the code.

>the coroutines
i meant the continuations
coroutines are something different

>he is forced to use a goto instead of implementing an exit condition
Hope you’re happy with your crappy-structured code

It is sometimes more natural to put the exit condition in the body of the loop

this.

homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf

If you don’t know, educate yourself. Please, for the sake of us all.

nothing if you only use it as exit point in a function