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
I haven't used a GOTO in a long time, though it was perfectly natural to use it when there was little else available. Considering that I started with JP, JZ, JNZ, etc, GOTO seemed a logical next step. Now that modern languages include so many more functional constructs, it would be difficult to find a reason for using GOTO. I suspect that, if the need existed, it would be due to timing/memory constraints and I'd be smarter to go back to Assembly code to optimize the routine. That being said, I don't consider the use of GOTO bad form, if it's appropriate to the problem at hand - a state machine implementation, for instance.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
-
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?
Break?
-
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
An occasional
goto case
in C#. Otherwise not since I advanced from BASIC. -
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've had to use GOTO for programming Access/VB6 forms when doing error handling. It was basically a poor man's version of the
Finally
block, used to clean up objects or database connections/recordsets. I don't think I've ever had any other instances where it was appropriate.Imagine that you are hired to build a bridge over a river. The river gets slightly wider every day; sometimes it shrinks but nobody can predict when. Your contract says you can't use concrete or steel - the client only provides timber and cut stone (but won't tell you what kind). Gravity changes from hour to hour, as does the viscosity of air. Your only tools are a hacksaw, a chainsaw, a rubber mallet, and a length of rope. Welcome to my world. -Me explaining my job to an engineer
-
Thanks allot leppie :mad: now i'm forced to make jumps :laugh:
Learn from the mistakes of others, you may not live long enough to make them all yourself.