do you use goto? [modified]
-
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?
-
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
Rajesh R Subramanian wrote:
if-if-if statements
Wouldn't evaluating an expression upfront to a variable and then using a
switch-case
provide an elegant in that case?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Hi, my name is leppie, and I use
goto
occasionally.xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out now -
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
The only time I've ever used goto was in the QBasic days, and in Visual Basic when I was first learning that language. I've never used it in any C flavor language, and never allow it when doing code reviews at work.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA
-
Rajesh R Subramanian wrote:
if-if-if statements
Wouldn't evaluating an expression upfront to a variable and then using a
switch-case
provide an elegant in that case?Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson1.
switch
works only with integral types and so it cannot be used everywhere. 2.switch
usesgoto
internally.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Burn him, he is a witch ;P
Learn from the mistakes of others, you may not live long enough to make them all yourself.
-
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
under any circumstance use goto I use the following
#define BeamMeUp(_goto) goto _goto int AtPlanet() { bool bToDangerous = true; if(bToDangerous) BeamMeUp(scotty); else Fight(); scotty: return ToEnterprise(); }
Learn from the mistakes of others, you may not live long enough to make them all yourself.
-
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
-
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
I use
label:
…goto label
whenever I have to usewhile (true) {
…}
So the creationist says: Everything must have a designer. God designed everything. I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?
-
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
To learn recursion you first need to know recursion!
-
And now I will turn you into a frog! POOF!
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 3 out now -
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
I have less than 5 gotos in the 500K+ lines of code I have written in the last 10 years so its quite rare for me.
John
-
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
Pakl wrote:
I am interested if you are using goto's
No, but I reserve the right to use it and not feel bad.
-
1.
switch
works only with integral types and so it cannot be used everywhere. 2.switch
usesgoto
internally.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
if
usesgoto
internally.while
usesgoto
internally.for
usesgoto
internally. function calls usegoto
internally. Your CPU only knowsgoto
internally. There's a reason why modern programming languages provide a collection of wrappers to hidegoto
from you.You know, every time I tried to win a bar-bet about being able to count to 1000 using my fingers I always got punched out when I reached 4.... -- El Corazon