|
vl2 wrote: hordes of incompetent dummies
says who?
vl2 wrote: There are *no* arguments against goto
At this point the discussion with you is over. I did make the mistake of spending time to look into some of the things you linked to, because I was genuinly interested in good examples in favor of goto. But now I realize you are but a troll.
BTW, most of Knuth's code is unreadable by todays standards. Welcome to the third millenium.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
As expected, a moron just managed to prove his complete lack of ability to think. Applause!
You're incompetent. Admit it. People like you should not be allowed to code.
|
|
|
|
|
Of course there are arguments against using the goto.
Have you actually read Dijkstra's paper? I did, and it was not a joke.
I also read Hopkin's paper, "A Case For The Goto".
That was a serious paper too.
|
|
|
|
|
Most of the first and second-generation languages were conceptually founded on some problem-oriented model. In focusing on a particular problem space, they tended to neglect other considerations. One result was that many languages were merely "assembler with better syntax" -- and the GOTO or branch instruction is impossible to do without in that scheme.
Third-generation languages such as Algol and C began the move away from a hard problem orientation. They focused on other desiderata, such as structure and legibility. With the expansion in the variety of conditional and iterative control structures they offered, the GOTO became less necessary. That caused Dijkstra and others to study the relation between the GOTO and legible / comprehensible program design, and to reach the conclusion that the GOTO is harmful in the great majority of cases.
All that having been said, there are still occasions when writing a GOTO is better practice than what it would take to avoid it. Indeed, some such cases involve using a GOTO to improve legibility and maintainability; transfer of control to a procedure's error handling exit is sometimes like that. However, it's best to be biased against GOTO, and to use it reluctantly, because GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Fran Porretto wrote: GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them.
Ooooh, I like that! Can I use it in my sig?
|
|
|
|
|
(chuckle) Feel free. It was spontaneous, but the more I ponder it, the more accurate it seems!
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|
Yes, I can agree that the goto statement can be confusing and I've never found a good use for it. However what is the difference between a goto and a exceptions? Exceptions are only suppose to be used for things that should never happen. Most of the time that I've seen them used for all error-handling methods. (E.G. Invalid user input) However I find throwing exceptions for this purpose, even with the performance hit, useful. It keeps the code cleaner and shows the next guy what I expect to happen. Just wondering what you thought?
P.S. I once worked in a 4k memory space divided into 2 sections. The only way to get to the second memory space was with a goto statement.
|
|
|
|
|
In 1974, my manager asked me to evaluate the new, highly touted discipline called "structured programming."
I was skeptical. At that time, I was programming in COBOL. In those days, COBOL was somewhat deficient in the amount of control structures provided. I had not yet read Bohm and Jacopini so I had no idea that the control structures of COBOL were more than adequate for the task. I suggested that I wait to perform a structured programming experiment until a new project came along.
In July, I was assigned a new project. The Chief of Naval Operations (CNO) Budget Office was in need of a text editor that could edit the descriptive portions of records in an indexed sequential file. The program would be developed and executed on a Unisys 1106 main frame computer. Unfortunately, the Budget Office also knew about the University of Maryland Text Editor (med) which, for all intents and purposes, replaced the Unisys provided editor (ed). The Budget Office wanted the interface to be "just like med" a seemingly impossible job for the short project time (three months). Fortunately, I found that med contained an API that would allow me to use the editor against the textual fields of the indexed sequential file.
So it began. For this project I could not use a GOTO statement, a standard tool of the COBOL programmer of those days. I struggled with the problem. It wasn't that the solution was difficult; the solution was difficult without using GOTOs. Finally, in September, I finished. When queried by my manager, I told him that the programming effort took longer than it would have had I not used the structured programming paradigm. We agreed that, even though some rather impressive academians had suggested that structured programming was the way to go, we would shelve further use of the method. I placed the code listing in one of the drawers of my desk and returned to programming in my normal unstructured way.
Then, in December, I received a call from the CNO production office. It appeared that a program that I had written had blown up. The production office provided the symptoms and the name of the program. I looked in my drawer and found the flawed program. When I opened the listing, I realized that this was the program that I had struggled with. As I reviewed the code, in light of the comments provided by the production office, the bug just seemed to jump from the page. It was such a simple error. But had I written the code in my normal manner, I would never have found the problem so quickly. After about fifteen minutes, during which I recoded, recompiled, and rebuilt the software, I called the production office and advised them that the software was ready for reinstallation. Neither they nor I could believe how quickly the bug was found and fixed.
Since that December day in 1974, I haven't used a GOTO statement in my work (excluding assembler, of course).
Gus Gustafson
|
|
|
|
|
Because they are ignorant idiots. Goto is absolutely essential in a number of cases. Most notable are:
- Implementing state machines. The closest construction to state transition is goto, so it must be expressed as goto.
- Various generated code (from higher level languages/DSLs)
|
|
|
|
|
gotos are definitly not essential for state machines. there are a number of patters and frameworks that are a better solution than goto hell.
if this code has higher level languages as output then i dont believe gotos are required but if the code is not touched by human hands...
|
|
|
|
|
Mind naming a language feature which is semantically closer to the notion of "state transition" than a simple goto?
|
|
|
|
|
switch
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
No way. Switch is semantically more complex, and if you want to implement state machine over it, you need to introduce additional entities - namely, current state variable. And, in case of C, there is a horrible way to fail by forgetting a break statement - which also has nothing to do with the essence of a mere state transition.
|
|
|
|
|
The argument about forgetting a break statement is not valid as that could apply to forgetting a goto statement too.
And, the Strategy pattern can implement a state machine. There aren't just two alternatives.
|
|
|
|
|
|
During 30 years as programmer - I did not find any case for using GOTO instead break/return/exit_conditions.
|
|
|
|
|
If it was so evil, why is it still there? Mosquitos that spread malaria are around for a reason. Right now, because it causes so many deaths (program crashes?) and suffering (coders finding code difficult to track), we think they're bad. They are there for a reason (keeping human population in check?): all you have to do is figure it out and learn how to respect them (don't create insecticide resistant varieties) and use them properly.
If you have nested loops, how would you jump straight out? Have nested routines with exits? Throw pretending that it is not a goto? Set lots of flags and check them every time? longjmps (goto in function form) are just a variant of goto. Why don't you just use a goto instead of wrecking your brain how not to use one.
If you don't wish to use gotos (squeezing the toothpaste tube in the middle) you don't have to (roll it from the end). Like a toothpaste tube that may not be squeezed the way you like it, you can choose to live with it or let it annoy you. If it annoys you that much, you could use gotoless languages (tooth powder?) like Bliss or Python.
|
|
|
|
|
|
What a clusterelephant it turned out to be.
Went in to work the sh*tty part-time abortion of a job I have at the moment. Had to leave an hour early (money I could have used) to get my daughter to her Futsal game in the extreme inner western suburbs of Sydney (think where Josh and all the other Sydney ponces live). On the way there pass the store I needed to drop into to get a couple of IT items I required. Wanted to drop in on the way but decided I better get daughter to game on time.
So had rang and SMS the coach to advise may be a bit late due to work and traffic getting to where the game is. Was told the game was at 15:00 he likes players there about 45 minutes early. He returns my call a couple of minutes to 14:00 and says Oh, the game's not until 15:45 you'll be nice and early. Then my daughter tells me that we were meant to receive an SMS from the club advising what when and where. Didn't get it. She is the only girl from last years team to return and didn't get a invite at the beginning of the year and I'm not getting emails or messages now.
Not happy Jan! does not begin to explain how I'm feeling about now, 20 minutes out from the sports centre and finding out I don't need to be there for an hour at least.
So I get to watch almost 2 full other games before my daughters game. Boring as bat sh*t.
Then get to fight the traffic on the way home, the only good bit is stopping off to buy my IT bits as the shop always shuts at 18:30. Get there to see that they have a hand written sign on the roller door of the shop advising that store hours had changed as of 07/11/2013 (2 days before, for the date confused Yanks). Mind you nothing on their website and when I was there a few days before nothing visible when the store was open as the roller doors are up.
Then I went home to a house with f*** all alcohol and me not buying any as I'm being good before having to go and get blood tests to get a elephanting docotr to sign off and say I am safe to drive for another year.
If you have diabetes, don't bother telling those sunshines that look after your license. My blood sugar is high all the time if anything and cause one tablet lowers blood sugar I'm in danger on having a sugar low coma. Sorry, didn't I just mention that my sugar level is always high and the doctorts whine at me about it, so low blood sugar coma is not an option. Phuicking Kunts they are.
So anyway, back to my Saturday bitch and moan. About to drive down to computer shop now. Think a couple of elephants and sunshines are about to be dropped.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
That's a pig poo of a day, Mr. MM.
My Saturday was a tad better than yours. Mind you, it pee'ed with rain most of the day so Mrs. W and me pontificated over long-delayed plans about getting out into the garden and giving it its winter cutback and prune; just as soon as the rain eases off and the south-east stops sinking into the English Channel because of the weight of the surface water that has nowhere to go.
We hot-stepped to the mall for coffee and bought some crisps and snacks. I put two bottles of Cooper's and a Boag's in the freezer for a snap chill. Then we settled down and watched the Springboks beat the Sheep Shaggers XV. The beer was most yummington, as was the score.
I went online after and bought two tickets for the Boks game against France in a couple of weeks and we're booked on Eurostar and a hotel for an overnight stay after the game. I hope the French don't ruin my Big Day Out but knowing those buggers, they can surprise at a pinch.
It were a good Sat'dee it was. Better than yours because I had some beer.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
'Twas a good game, even if the 'Bocks won rather than us. Hope they kick some French behind!
I suspect that the treatment you get from the locals will depend on two factors: what you are wearing, and who wins...
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
Well, I had to run my 21 km training with a swollen foot, just because the f*#+in' marathon is upcoming...
Veni, vidi, vici.
|
|
|
|
|
Talk about 1st world problems!
Man up!
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
I own a great coat with a sheep wool lined collar (Pictures[^]).
Sad thing is that this one is great for autumn (fall) (temparatures down to 6 C are no problem), but I think it will not be enough for the upcoming cold swiss winter.
So, now here is the big question mark:
Does anybody know where I can get a comfortable winter coat, preferably fully wool lined, for a reasonable price? - If the store isn't located in Switzerland, South Florida, Massachusetts shipping option to switzerland is a must.
I also thought about buying a camel hair coat, but I think it will not be worth the expense.
If you suggest a wool lined coat I prefer suppliers who can assure me that Griff never was near to the sheep nor the wool.
|
|
|
|
|
Marco, check out the wool coats at L L Bean[^]. They offer free shipping (within the US/Canada) and sell extremely good quality and long-lasting products at fair prices. I've been a regular customer of theirs for about 30 years.
/ravi
|
|
|
|
|