do you use goto? [modified]
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
Yes, but I didn't inhale.
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Personally, I haven't come across an instance where I had to follow Rule #2.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Actually, goto isn't *that* bad. In fact, MFC Framework code uses goto for handling initialization failures. But, I'll agree if you say that one will need goto very very very rarely. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
So rare that its basically extinct?
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "You're an idiot." John Simmons, THE Outlaw programmer "I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon
-
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Personally, I haven't come across an instance where I had to follow Rule #2.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
I know I owe you an email. It's still in my drafts folder. Will send it off. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
In a situation like this[^], I *will* use goto. And yes, I know what I'm doing.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Yes, but the rules (as Vikram so adequately pointed out in his post below) is not for the exceptions but for the general case. Besides, Personally, I'd go for Judy's method (following the link you posted) as opposed to the goto method. Ugly as sin it may be but I find it readable and it maintains "the rule".
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "You're an idiot." John Simmons, THE Outlaw programmer "I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon
-
I don't use Goto and I get rashes when I see one. So, how about Exit/Break? Is that justifiable?
Justify? Before whom? If something serves the task at hand better than anything else then use it. How about letting those who try to enforce some rules at all price let do the justifying for a change? You might discover that many just howl with the wolves, but don't actually know why. In my opinion many of the rules are not written in stone. They are supposed to help us, but chaos does not automatically break lose if you decide to ignore them.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
-
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Personally, I haven't come across an instance where I had to follow Rule #2.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
Vikram A Punathambekar wrote:
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1.
Rule #3: Never goto #2.
Do you know...LinFu?
-
I know I owe you an email. It's still in my drafts folder. Will send it off. :)
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Rajesh R Subramanian wrote:
I know I owe you an email.
The PHB thing? :~ Anyway, send it off; I'll read it tonight.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
No. I've simply never found a need for it in any reasonably coherant programming language.
Anna :rose: Linting the day away :cool: Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"
-
Vikram A Punathambekar wrote:
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1.
Rule #3: Never goto #2.
Do you know...LinFu?
:groaaaaan: But that warranted a 5! :-D
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
My opinion in using gotos is like C programming: it is up to the programmer to code properly. Some are so skilled to write ugly C code. If used properly, goto can could may might have a place in our hearts. E.g. the MS-DOS batch script below (tested on WinXP):
@echo off set i=0
:loop
set /a i=%i%+1
echo Loop %i%
if not %i% == 10 goto :loop -
Christian Graus wrote:
I've never used goto
Not explicitly, anyway. If you've ever used a C break or continue, implicitly you have, since break and continue are simply goto's with an implicit label that is just outside or inside the current end of scope.
Graham Bradshaw wrote:
Not explicitly, anyway. If you've ever used a C break or continue, implicitly you have, since break and continue are simply goto's with an implicit label that is just outside or inside the current end of scope.
By that reckoning anyone using an if ... then ... else is also using a goto. The argument is not that "jump" statements in a program are not required (in any non-trivial program they are unavoidable), but that structured programming constructs rather than the goto statment lead to more understandable programs. As Dijkstra said in his original letter[^] - "The go to statement as it stands is just too primitive, it is too much an invitation to make a mess of one's program." I haven't used a goto statement since I gave up programming in Basic
Graham Software gets slower faster than hardware gets faster - Nicklaus Wirth
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
As in "go to h***" when I see someone using goto. Marc
-
So rare that its basically extinct?
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "You're an idiot." John Simmons, THE Outlaw programmer "I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon
Again, not really. I've encountered situations (even recently) where I felt that a few goto statements will save me from writing a buttload of ugly nested if-if-if statements.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
Doesn't bother me at all to use goto. I haven't found a c++ compiler that doesn't support them. They're not evil, just one more programming construct. If it saves me 100 or 10 or even one line of code, I'll use a goto without thinking twice.
CodeWiz51 -- Life is not a spectator sport. I came to play. Code's Musings | Code's Articles
-
My opinion in using gotos is like C programming: it is up to the programmer to code properly. Some are so skilled to write ugly C code. If used properly, goto can could may might have a place in our hearts. E.g. the MS-DOS batch script below (tested on WinXP):
@echo off set i=0
:loop
set /a i=%i%+1
echo Loop %i%
if not %i% == 10 goto :loop -
Vikram A Punathambekar wrote:
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1.
Rule #3: Never goto #2.
Do you know...LinFu?
Philip Laureano wrote:
Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Rule #3: Never goto #2.
Do you like recursion? :) Rule #4: Know when to break Rule #3. Rule #5: Never goto #4 Rule #6: Know when to break Rule #5. ... Robert
-
Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\
Listen to the toad! www.dotnettoad.com[^]
modified on Monday, May 19, 2008 4:44 AM
-
Hi, my name is leppie, and I use
goto
occasionally.xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out nowIn periods or on a weekly basis?
-
In periods or on a weekly basis?