[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Have you ever used goto?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 1

File: 1498079144123.jpg (6KB, 300x201px) Image search: [Google]
1498079144123.jpg
6KB, 300x201px
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.
Thread posts: 19
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.