Thread #108297544
File: file.png (1.6 MB)
1.6 MB PNG
>years of programming experience
>number of times you have used a "goto" statement
12
1
25 RepliesView Thread
>>
>>108297544
42
hundreds. untold hundreds of thousands if you count BRx/JMPx in assembly. The dangers of goto are extremely overrated, jumping forwards in the code is pretty tame, the problematic uses of goto are things like jumping backwards into the middle of a control structure, or jumping from one procedure into the middle of another procedure (common hack in fortran and assembly). In modernish languages goto is mostly useful for getting out of deeply nested loops or other control structures, and for that it's pretty completely harmless - the alternative is putting those nested loops into their own function then returning from that function, which is functionally identical, and after inlining generates the exact same code, only now it's less readable than the simple goto version.
>>
>>
File: 1495153649295.jpg (377.1 KB)
377.1 KB JPG
>>108297544
0
0
i dont even know what the fuck a goto statement is
>>
>>
>>
>>108297544
13
idk
They're useful in C for cleanup on early exit. If you have a bunch of alloced data and you have conditional exit points, instead of returning when entering an if statement, goto clean up, where you have multiple tags depending on how many variables you need to free. Then the top tag is the for when max data has been allocated and the higher tags "fallthrough" to the lower tags. Prevents duplicate clean up within a function
>>
>>108297642
>nto the middle of a control structure, or jumping from one procedure into the middle of another procedure
C++ doesn't even let you do this tbqh
Midwits hate goto because they feel like expressing an emotional hatred for it will make people think "woah, this guy REALLY agrees with something Dijkstra once said (about a different language where the keyword meant something very different), he must be a godlike programmer!" It's basically just virtue signalling, like pretending you really hate Hitler even though your family was never even inconvenienced by Hitler in any way, because you think it'll make you seem like the best goy.
>>
>>
>>
>>
>>
>>
>>
File: CHICKEN_JOCKEY.jpg (52.5 KB)
52.5 KB JPG
>>108297544
13
3 or 4
was still starting at the time and I didn't want to use while loops for some autistic reason
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>