|
I'm sure it was the week after your cat died but I'll have the Casio just in case!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
|
Bully for you.
I used one yesterday when my doorbell camera showed some people, with little booklets in their hands, at my door.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
Aw man... you can't just drop that on us and not show us the code! That's just mean!!!
|
|
|
|
|
Mm.. it took me 2 hours to write the function.. that doesn't have goto in it in the end!
To be fair both the function was complicated and I was distracted!
|
|
|
|
|
it's an old view but as a Hardware/Firmware type I cannot see the hatred for goto, I mean the jmp is a direct map and it produces a smaller binary. Goto is like an axe very useful but very dangerous. An axe wont cut your hand off, misuse it and you could be missing a hand very easily!
|
|
|
|
|
Obligatory XKCD[^]
GOTO is perfectly fine in some scenarios. It's a language feature not a bug. I have used maybe 4 over the past 15 years. So not common, but absolutely has its place.
|
|
|
|
|
Why not use them? Sometimes they make sense.
Spaghetti code is spaghetti code regardless whether it uses classes, is structured, or just plain crap.
|
|
|
|
|
Coming from a embedded back ground, GOTO maps directly to JMP! write assembly without JMP. Like you said I battled with object oriented code that is c*ap but well structured. I like anything don't blame the tools, blame the tool using the tool!
|
|
|
|
|
I have seen some terrible C++ code, the worst was a child of a parent, instantiated as the parent.
SO child * myclass = new parent.
WTF!
Which frigging function is going to get called, the base class or the overridden one!
I wanted to punch the person who wrote that.
|
|
|
|
|
I once used a "computed goto" - it was in FORTRAN where this kind of thing used to be expected!
GOTO is my go-to command I go to when I need a goto.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Find In Files / Current Project / "goto"
Matching lines: 1254
it's common in C, as it's the cleanest way to handle error conditions.
|
|
|
|
|
In high level languages... Ok, maybe you have more possibilities and you should avoid using goto's
But try to programm in Assembly, in PLC LAD or other similar "low" level languages without it.
It is like many other things. Use it wisely and there would be no problems. Abuse or misuse it... and you will burn in hell (or you will be damned and sent to hell by the people who inherit your code)
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
while ( true ) { ... break ... }
|
|
|
|
|
also
for (;;) { break; }
do { break; } while(0);
that's just pretending. everyone knows that break is a goto. own it!
|
|
|
|
|
I think you should use a
#define ever ;;
so that you can program
for (ever) {...}
Or,
#define WW3
do {...} while (!WW3);
|
|
|
|
|
Everytime, I thought I needed a goto, I found I could just put a return inthe middle of a loop.
That's a more better way to make things sucky.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Gotos are fine. Like, "I will be back in 30 minutes. I have to GOTO the store."
I have to GOTO the baseball game.
|
|
|
|
|
Slacker007 wrote: I have to GOTO the store
Except that's really a function call - you do intend to RETURN from the grocery store, don't you?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
1. Create a workflow manager using generics, interfaces, class abstraction, enums for state and continuation.
2. Break up your code into small workflow steps.
3. On each step, check for termination.
4. Or to get really fancy, return a code that says what step in the workflow to skip to.
5. If you really want to be cool, allow for async workflow steps!
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
When can I read the article ?
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Nuke the location in which the GOTO was used, sow the glass crater with salt, and plow it in. Then scatter biological and chemical agents all around the area, making it inaccessible for 10,000 years!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
It4 seems to me that in a language with no local functions or lacking in structured error handling, gotos have a useful place. A limited place, but a place all the same.
|
|
|
|
|
I use goto all the time.
Every loop and conditional expression you use calls it to their hearts' content; there's no avoiding it.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|