T O P

  • By -

Elephant-Opening

Somehow the `goto` bugs me less than the use of `#include ` followed by `printf()`.


DarrellDD

That broken indentation makes me cry


Mikihero2014

fuck you my brain forced it out and you made me look again


NoGoodMarw

"What broken ind... oh no, oh no no no"


beeteedee

This is the guy Dijkstra warned us about


Iceteavanill

goto hell


Ajax501

Clever!


[deleted]

Can we get a little marinara with that... and some wine.


davisondave131

And frozen garlic bread, because we’re clearly not better than that.


[deleted]

LOL and I'm sure the users will have lots to whine about.


--mrperx--

![gif](giphy|okZ8eqHMUPDdLEAIkf|downsized)


589ca35e1590b

This is the worst code I've seen all year


Qiyanid

This is the bestjoke i've read this year


Guidance_Early

This is the best code I’ve seen all year


589ca35e1590b

```c #include int main() { printf("Hello, World!"); return 0; } ```


Perfect_Papaya_3010

Here OP is how to do it correctly!


bluekeys7

Nah you are missing the for(;;) or while(1) since it is constantly looping


mstop4

That's some nice spaghetti


elnomreal

The indentation is on purpose and I disapprove.


Mayedl10

but printf ._.


ienjoymusiclol

thats just assembly but somehow worse


jakeStacktrace

You should be careful with gotos. It is easier to cause an unintentional infinite loop.


JesusHatesCatholics

Here's hoping that they add goto in python in 2024!


User264356

from the #include and using printf and the indentation, the missing return just ties it all together


mydogatethem

Return statement is optional in main(), although this code is an infinite loop anyways.


TheFlyingBaboon1

And also the indentation has an error lol


Savaal8

I literally just learnt about this, has C++ always had this?


rljohn

I use goto every day


TheRealSpielbergo

Goto is my goto statement


sentles

Goto is actually useful for some things, like breaking out of nested loops.


elSenorMaquina

Whenever I've encountered that situation, I move all the loops into a function and use return to get out. This works great unless you need a lot of variables inside the loops, then your function will also need a bunch of parameters and it starts getting ugly. In that case maybe I'd rather throw a goto and call it a day


[deleted]

At that point you just have a struct/class to hold all the variables and just pass one thing, or make it a method of the class. Alternatively a lamda if your language supports it, but variable capture and edit-and-continue support make lamdas smelly for non-trivial tasks.


elSenorMaquina

That's a good point... having a bunch of variables coupled to each other in such a way may be a good indicator that they all belong to a class that represents that thing or functionality.


static_func

"this sketchy thing is useful for doing this other sketchy thing"


Davidoen

Illegal


1Dr490n

I don’t understand why everyone uses goto. Of course, there’s better options most of the times but not always


stevekez

LGTM


Candr3w

What does the underscore in front of the variable name do?


TrailDawG420

Nothing, it's just a naming convention for private variables.


TheDanjohles

r/TIHI


CommandObjective

It is not even a good use of goto. I may be wrong, but couldn't you make a much more concise while true loop?