|
The original paper (indeed the original "considered harmful" paper) is here: Goto Considered Harmful (Dijkstra)[^]
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Isn't this a rehash[^]?
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein
|
|
|
|
|
The error with the two gotos was vague. I would assume that if it compiles, the second goto never gets called. There has to be more to it than that and I hate articles that don't quite explain it.
|
|
|
|
|
Why wouldn't it get called*? The whole problem with that second goto is, literally, that nothing prevents it from being executed.
*: I find that terminology slightly misleading, by the way.
|
|
|
|
|
I'll admit I thought that there were {} around that.
|
|
|
|
|
Does this make it clearer?
if ((err = SSLFreeBuffer(&hashCtx)) != 0)
{
goto fail;
}
if ((err = ReadyHash(&SSLHashSHA1, &hashCtx)) != 0)
{
goto fail;
}
if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0)
{
goto fail;
}
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
{
goto fail;
}
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
{
goto fail;
}
goto fail; if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
{
goto fail;
}
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Yeah, I finally realized that after the top comment. I'm surprised that it passed coding. I assume that they're not using a lint program or something to vet such obvious mistakes.
|
|
|
|
|
*loads a pair of sawed off shotguns with buckshot*
Okay. Who's the first noob who's going to argue that goto should exist?
|
|
|
|
|
So, the x86 instruction JMP will finally be banned?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Checkmate!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I don't think even Dijkstra argued it should not exist in assembly, just nowhere higher in the software stack.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Rob Grainger wrote: just nowhere higher in the software stack. ..nonsense.
Goto was a beast in the old days; try and debug an application that has no methods and lots of goto's; it makes it hard to see the programs' flow. THAT's why it was considered harmful. Idiotic generalizations like 'X is harmful' are more harmful than your modern goto. In the specific example from Apple one can just as easily point to the codeblock-delimiter.
I almost never use the instruction, but the idea that it's harmful is utter nonsense. Every command is harmful in the hands of a moron.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Excellent piece of out-of-context quoting. I stand by what I said, Dijkstra who argued that goto should be eliminated from high-level languages.
I also think he's right. I've seen goto abused plenty of times, without exception in situations where there are alternatives that would have been better employed.
The only possible exception is for machine-generated code, for example compiler generators sometimes use goto's to encode finite state machines. Even then it can be dubious.
In modern languages, goto can be even more harmful - for example jumping between scopes where construction/destruction should have been invoked for example. There are almost always better alternatives. Goto's always reduce readability of code, as they can obscure flow of control.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Rob Grainger wrote: Excellent piece of out-of-context quoting. Where? I didn't quote anyone, AFAIK.
Rob Grainger wrote: I stand by what I said Ditto, since I haven't heard any convincing arguments yet.
Rob Grainger wrote: I've seen goto abused plenty of times Does that make goto harmful? Come on, the "on error resume next" or empty catch-block is more dangerous, and more often abused.
Rob Grainger wrote: goto can be even more harmful - for example jumping between scopes where construction/destruction should have been invoked for example. ..gimme an example in code, and I'll prove that "IF" is just as harmful by duplicating the goto-effect.
Rob Grainger wrote: Goto's always reduce readability of code, as they can obscure flow of control. ALWAYS and CAN are contradicting each other there. Same thing can be done with other structures.
Rob Grainger wrote: There are almost always better alternatives. True, but that doesn't make goto harmful, does it?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The World Wide Web is a smashing technological success. But the man who invented it wants it to break down more cultural barriers, thwart government snooping, and let the Web run applications not just house documents. So, what have you done for us lately?
|
|
|
|
|
In March 1989, British scientist Tim Berners-Lee published a paper proposing an "information management" system for his laboratory. His supervisor, Mike Sendall, scrawled some brief comments on the cover: "Vague, but exciting." What's this 'web' thing, is it worth looking into?
|
|
|
|
|
Valve has made Dota 2‘s Direct3D to OpenGL translation layer open source. This is the piece of code that allows Valve to take a standard DirectX Windows game that uses the Source engine (Dota 2, Team Fortress, Portal), and easily bring it over to Mac OS X or Linux/SteamOS. Insert DirectX tab into OpenGL slot
|
|
|
|
|
Have your kids racked in-game purchases without your permission? A new lawsuit against Google, which follows a successful one against Apple, aims to recover some of that money. "Teach your children well"
|
|
|
|
|
Alternatively, set up an account that can't be charged to and no more in-app purchases. It's not hard.
|
|
|
|
|
Apps, Tablet PC devices, etc. are not for five-year-olds. They should be playing with real kids on real playgrounds instead of being dumbed down and consumerized from the ground up. There's been an interesting, serious report on German TV a few months ago that outlined the reasons why it's not a good idea for children's mental development to let them interact with all these gadgets.
|
|
|
|
|
I regret that I have but one upvote for you.
TTFN - Kent
|
|
|
|
|
Exactly right, our youth seems to be pulling away from physical social interaction and that's a shame.
|
|
|
|
|
|
"Be smart and make all purchases require a password."
That's exactly the problem here, having purchased an app there's a half-hour window where any further purchases go through automatically. That's bad design on Google's part, hence they're being sued. All seems fair to me.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
My kid bought $20 on his Kindle, then went on to buy $100 more because he thought it was play money. That's when I enabled security and now require a password for in-app and any purchases.
|
|
|
|