[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]

What's wrong with GOTO ? Not that "REEE MY PROGRAM

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: 34
Thread images: 3

File: 1499326941501.jpg (45KB, 640x640px) Image search: [Google]
1499326941501.jpg
45KB, 640x640px
What's wrong with GOTO ? Not that "REEE MY PROGRAM FLOW" or "REEE MY READABILITY". It works.
>>
>>61393461
nothing wrong
>>
File: 1323.jpg (30KB, 552x600px) Image search: [Google]
1323.jpg
30KB, 552x600px
>>61393461
Kill youself personafaggot
>>
>>61393461
if your code has no readability it has nothing
>>
>>61393461
Creates more work in the long run.
>>
>>61393591
Not the same thing.
>>61393611
I personally think it allows normies to understand it. For example
for (i; i<3; i++;)

is harder for a normie than
if i<3
else
i++;
>>
>>61393650
>Not the same thing.
The difference is only quantitative, not qualitative.
>>
>>61393664
Yo, that code is horrible I get it, but check >>61393650
>>
You're tasked to fix a bug in a piece of software that you didn't write, and you've never dealt with before.
The first thing most developers do is attach a debugger and follow the calls.

Goto breaks this.

It makes software harder to debug, harder to maintain.
>>
>>61393650
>if i<3 else i++;
There's no goto in there.
>>
>>61393707
Huh, didn't know. Any other reason?
>>61393719
Sorry, put an GOTO at the end.
>>
>>61393707
>The first thing most developers do is attach a debugger and follow the calls.
Goto wouldn't replace function calls. If anything, it would replace for, while and structured ifs.
>>
>>61393751
>Sorry, put an GOTO at the end.
You've now wasted five lines instead of one, and there's no structure in the code, it's all flat.
>>
goto is fine
you would consider it normal if you coded in asm
>>
>>61393650
why would it possibly matter if random people not working on the code can understand it
>>
Nothing wrong with goto. Newbie programmers are of course told not to use it, because it's too much power for them to handle.
>>
>don't use GOTO, it jumps program state around
>use loops that are functionally exactly the same thing
>>
>>61393863
>that are functionally exactly the same thing
...but also introduce easily parsable structure and useful compactness to the code.
>>
>>61393461
you need a good reason to do it
if you have one, nice
>>
>>61393461
What's the point of GOTO when you have continuations?
call/cc
is infinitely more useful anyway.
>>
>>61393781
Yeah, I said no "MY STRUCTURE" or "RPROGRAM FLOWWW"
>>
>>61393461
GOTO is a lvl 10 spell. This means that level 1 programming wizards are not able to use. If they try to use it they will usually fail and make a mess.
>>
>>61393461
GOTO is perfectly acceptable and actually preferred in some situations.
Only newfags, retards and poojeets don't understand the benefits of GOTO and when you should use them.,
>>
>>61393461
It's slow, a lot of go to statements make your code look and run like shit especially in any c-esque language.
>>
>>61394176
optimizing compilers exist
>>
>>61394202
not an argument.
>>
>get told never use GOTO as if it was program wide
Even in C it's just in scope of function and it really clears the structure because you have no exceptions.
If you have exceptions then you could use them instead of GOTO but ecceptions are bad.
If you program C or sepplesshit, you SOMETIMES should use GOTO unless your program is really trivial, because it makes the program easier to read.
>>
>>61393461
muh goto considered harmful (taken out of context)
>>
>>61394027
But that is exactly the problem with it, so you're just being retarded.
>>
>>61394176
Citation needed. There's exactly zero reason to assume or conclude that goto is slow.
>>
>>61393461
It should never be the first port of call, if you can write the same code without GOTO then it'll probably be better.

On the other hand breaking out of switch statements within a loop can be a real nightmare if you want to do anything after the statement but before the loop iterates
>>
because structured programming is easier to reason about.
>>
It's really hard to refactor arbitrary jumps, which makes adding on to old code without adding bugs difficult.

Try working in asm for a while. Putting a goto here and there feels nice at first, but you'll eventually find it's not worth the technical debt.
>>
>>61393461
GOTO is too powerful for brainlets to handle.
Thread posts: 34
Thread images: 3


[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.