Name one thing wrong with gotos

Name one thing wrong with gotos.

Other urls found in this thread:

david.tribble.com/text/goto.html
twitter.com/SFWRedditImages

There is literally nothing wrong with jmp

What about now?

Nothing, only meme reddit programmers hate goto because their head cannot understand it at assembly level.

It can become a bad habit in some languages.
But they can be very useful to implement tricky things that in a more "correct" way would be too complex/time consuming.

They seem to cause useless autistic debates, they've been going on for a while now.

Name one problem gotos solve better than functions

I use them from time to time in making dank lisp macros.

If used sparingly, nothing.

Inducing nihilism in programmers.

Fuck off retard

elitism to make programming less accessible

gotos in languages that don't restrict a goto to the scope of the function/block and lets you jump around everywhere resulting in your code going all over the place with no structure.

>no fun allowed

It's called FREEDOM asshat.

achtually ISAs reliant on jmps and turing machines in general are more difficult to secure than dataflow architectures

There's nothing wrong with goto. They're only hated because Dijkstra said they're harmful. If only people listened to his opinions on OOP, as well.

They have a limited amount of valid uses, but should be used sparingly. If left unchecked gotos will end up eating away at the code and leaving only spaghetti. 99.99% of gotos should be abstracted away with loops and function calls.

The fact that so many people in this thread are supporting them is not surprising considering how many people argue that their code is "self documenting".

literally a shorter, simpler function().
i use it just to keep things lazy and simple when needed, but use functions when i need more complex things done.

Sup Forums is full of college and high school kids and have never seen or developed in a real big codebase

of course using gotos and bad programming practices is fine for their less than 1000 lines programs.

also, they will never have to read/change/improve/refactor/add features to their code after they have submitted their assignment

It's also full of cunts who act superior and just shitpost about everybody being plebs.

Code is easier to maintain and reason about using structured practices. Gotos allow an incompetent programmer to write disorganized spaghetti code. Most programmers are incompetent.

C++ needs a break x command where x is the number of brackets that will be broken out of.

Fine to use if contained like in a specific algorithm. I'll fucking shove the code up your ass if I see it jumping outside of it's scope.

>breaks out of scope, program, OS and this world
Live free, sepples.

People have a problem with them like people have a problem with languages such as Java. It allows programmers to create working but badly optimized code, as opposed to other languages in which working code is usually optimized by default because of how the language forces you to code.

That doesn't mean Java is a bad language because of that (it's bad for other reasons); you can code rather optimized things with it. It's just that sometimes you end up with Notch; functioning and popular but absolutely fucking terribly coded software.

At the same time in Enterprise environments, all you need is a couple hundred or thousand line application right now and you aren't really concerned about it's preformance because any impact it will ever have will be negligible.

Letting you unambiguously escape from blocks and move to a particular point in the control flow while in a given scope with defined local variables.

in C: error handling

Sounds like a great tool to debug, how is this bad?

>ctrl + f
>goto fail
>phrase not found

goto fail;
goto fail;

>no structure
Not true, you can make a perfectly structured program with gotos.

Well, it's not just about optimization. And I doubt gotos have nearly as much overhead as defining a new function. It's about maintainability, and the issue with both Java, and gotos, is that they let people write code that quickly becomes a disorganized mess where refactoring is equally as expensive as just re-writing the whole thing from scratch.

>developed in a real big codebase
Considering most large enterprise codebases are in c# and in c# goto's are required to fall through in a switch statement, it seems like you've never seen a large codebase either.

Too late now, the damage is done.

Even if it's perfectly possible to write well structured programs with liberal use of gotos, no one will do it simply because of the stigma now associated with it.

Go ahead and implement goto-cleanup with functions. I'll wait.

Poor man's longjmp.

>Name one thing wrong with gotos.
name: printf("name "); goto one;
wrong: printf("wrong "); goto name;
thing: printf("thing "); goto wrong;
one: printf("one "); goto thing;

Backwards gotos are usually evil, use loops instead.
Forward gotos are usually great, and often the best way to do multiple breaks & cleanup.

Your control loop is wrong if you're using labels/gotos. You can always refactor it.

>Name one thing wrong with gotos.
Lack of compiler optimization

The fact i can only goto numbers and there's no number index to tell me which number's Ive used already

i use goto all the time instead of FOR loops.

if counter < max counter
goto start_label

annotated goto-statement considered harmful: david.tribble.com/text/goto.html

they fuck up program flow

you can't start a C identifier with a number

programmers

thread confirms that 99% of this board are just shitters who write 1000 line projects in their basement alone and think theyre programmers

int main(void) {
goto a;
a:
return 0;
}

You posted a thread about them.

They're only useful in the only language that really supports them: c error handling for complex initialization you don't want to shit up 5+ stack frames for.
Which is a ton of words for "in the Linux kernel"
Anywhere else you're better off with RAII and exception unwinding doing the cleanup, since that's harder to get wrong. It's slightly slower but unlike a kernel 99% of your code base doesn't need to be cycle optimized.

thanks for the kek

nothing desu, though they're worse than RAII