Have you ever used goto?
goto use useful for a common exit handler, common actions in case statements and breaking out of multiple loops.
Since GCC 7 started complaining about implicit fallthrough in switch statements, goto now needs to be used for any fallthrough in switch statements.
xD every time I hack into the matrix@echo off
title 1337 MATRIX HACK
color 02
:matrixhax
echo %random% %random% %random% %random% %random% %random% %random% %random%
goto matrixhax
lol
>>61013840
It's quite useful when programming pics in asm
no
They're sometimes used for error handling and cleanup in C code I think.
Yes
in Human Resource Machine
>>61013840
yes
Yes, because Ti-82 basic didnt have function
Only two times really,
1. When I was starting out and didn't understand flow
2. Learning assembly
>>61013840
I use Goto to escape large loop chains and to access multiple features from a pop-up run dialog.
I hit win+space, type some shit, it Goto's the label of whatever I type.
Why not Gosub or Function? Because fuck you, there's no point wasting extra cycles to do useless checks then terminate 2 functions separately.
Actually I do use Function for some things. Only added that recently to cut down useless label-bloat.
>>61013840
>Have you ever used goto?
Gotos are convenient for breaking out of nested loops or for common actions, such as error handling.
The real question you should be asking, OP, is have you ever used longjumps.
>>61013840
No because I don't like messy and insecure code.
>>61013840
I'm really lazy so I use them all the time.
>using loops
void foo(n) {
printf("Hello!\n");
if (n >= 0) {
foo(n - 1);
}
}
foo(10);
My first language was BASIC, so, yes.
>>61013989
upvoted and gilded xd
>>61013840
once, when I had to get out of the current stream of code on a server in C, never again though.
>>61014303
This.puts("Success!");
return EXIT_SUCCESS;
e_glfw:
glfwTerminate();
e_fs:
glDeleteShader(fs);
e_gs:
glDeleteShader(gs);
e_vs:
glDeleteShader(vs);
return EXIT_FAILURE;
Makes the code so much clearer.
>>61015844
The only code I know uses it is Lua, for error handling if I remember it right.
>>61015844
when trying to implement try/throw and coroutines in C
they were pretty buggy, and couldnt be used for anything more then toy programs, but it was neat.