Kat
Except basic lol
Talula
Stefan
Stefan
actually, why dijkstra said goto is cancerous is because its unfortunate couplance with turing machine
Stefan
and not with algorithm
Stefan
if you really look into automata theory, you will see loops are indeed constructed using jumps/goto
Stefan
Stefan
try to read assembly back and forth, which is already a form of random access machine and a universal turing machine
Stefan
you will see
olli
Stefan
Stefan
dijkstra wanted people to not think about low level constructs
Stefan
but pure high level thing like algorithm and data structure
olli
jumps are goto
Then you probably did not get my initial statement.
goto decrease readability and maintainability in C/C++ Code and should be avoided unless you can justify it's usage.
Additionally C++ does not define the instructions used on assembly level.
olli
yes
So Java does not support loops 🤷♂
Stefan
Kat
Assembly just uses jmp for loops
Kat
So essentially all loops are gotos. But if the language you are using abstracts those gotos then use that abstraction 100% of the time. It's good practice.
olli
Nobody is questioning this. But a language such as C or C++ does not need goto statements to support loops
Avezy
cmp eax, 1
jz 0x04a876
Stefan
so how do you do state transition without goto
Kat
Stefan
abstract each state into one method?
Kat
But it abstracts those into something useful
Avezy
Talula
Kat
Behind the abstraction, all languages are just doing jne, je, jmp, call, etc behind the scenes
Kat
No, but that's just how it works.
Kat
A compiler just converts the syntax of a higher level language to machine code.
Kat
Any loop in a higher level language is essentially just conditional jumping
Kat
I think we're a little confused here
Kat
Are you saying that a higher level language doesn't involve gotos or use them in any way or are you saying that you shouldn't use gotos in a higher level language?
Stefan
olli
Kat
Kat
I thought you were disagreeing about jumps being used behind the higher level code for some reason. My bad.
olli
I think we can agree on it, cant we? :)
Kat
Yeah lol
Stefan
http://wezfurlong.org/blog/2004/jul/goto-isnt-evil/
Stefan
also, without goto, you cannot effectively exit an inner loop without a flag
Talula
Without JMP computer wouldn't even work but... in C/C++ you don't need goto, I haven't written a sigle program in my life that needed goto in C/C++/C# (I don't even know if C# has goto).
⚛ Hz
Stefan
MᏫᎻᎯᎷᎷᎬᎠ
Stefan
Stefan
how does goto incur memory leak
Anonymous
yuuki
Good question.
Although I'm not sure myself, I vaguely remember that it's not safe to use.
Again, sorry for the mistake. My bad.
Anonymous
MᏫᎻᎯᎷᎷᎬᎠ
Yo check this
MᏫᎻᎯᎷᎷᎬᎠ
https://www.facebook.com/groups/cppEnthusiasts/permalink/2151498654909443/
Liam
Soooooooo... fast..
Kat
Kat
Oh cool, didn't read that far down, just saw Facebook and it set off my Zucc detector lol
MᏫᎻᎯᎷᎷᎬᎠ
Lol
klimi
Welcome
Anonymous
Hello
klimi
Hi
klimi
Welcome
klimi
Welcome
Dima
klimi
Dima
klimi
Daniele°
😂
klimi
Daniele°
setcontext(&ucp);
Daniele°
welcome
Liam
WTF……
Dima
get rekt