View Poll Results: How often have you used 'goto' in the last 5 years?
- Voters
- 111. You may not vote on this poll
-
February 15th, 2004, 09:34 AM
#1
The grand 'goto' poll
Okay - it's not very grand at all but here goes - the purists among us would prefer a world without 'goto'. The pragmatists among us think that it's 'sometimes' the right tool for the job, so let's have a vote.
How often have you used 'goto' in the last 5 years or so? Be honest - this is an anonymous poll so no-one needs to be embarrassed or fear for their reputation...! It's just a survey. No-one will get hung!
-
February 15th, 2004, 11:31 AM
#2
I think once
All the buzzt
CornedBee
-
February 15th, 2004, 11:47 AM
#3
A request for anyone voting that they use goto regularly in a C++ program:
Please tell us the name of your software product(s) where you have used goto regularly.
Regards,
Paul McKenzie
-
February 15th, 2004, 11:59 AM
#4
Originally posted by Paul McKenzie
A request for anyone voting that they use goto regularly in a C++ program:
Please tell us the name of your software product(s) where you have used goto regularly.
Regards,
Paul McKenzie
I use goto regularly when programming in C (for cleanup). I have probably also used it in C++, but the product I'm working with, is mostly written in C. It's a Windows security product (PKI), running on WinNT/2000/XP clients. The name is RSA Keon Desktop or TFS Desktop.
/Jonas
-
February 15th, 2004, 12:27 PM
#5
Just as a side note. I performed a search on my entire VC++.NET directory for goto and it returned 2287 hits.
TDM
-
September 28th, 2004, 04:41 PM
#6
Re: The grand 'goto' poll
Originally Posted by TDM
Just as a side note. I performed a search on my entire VC++.NET directory for goto and it returned 2287 hits.
TDM
Microsoft should rarely be used as an example of good coding practice. I haven't used GoTo since I quite programming is QuickBasic 10 years ago.
-
September 28th, 2004, 05:29 PM
#7
Re: The grand 'goto' poll
Heck I just want to be part of a goto thread, I have always admired these things...
//As a side note.. I have never used goto, but I don't know why, It just seems to
//have turned out that way. I think I am goig to put a goto into the C++ code I
//am wrting right now, just because I don't like people telling me what to do, and
//this goes double if the person is a Professor
Last edited by souldog; September 28th, 2004 at 05:55 PM.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
September 28th, 2004, 06:31 PM
#8
Re: The grand 'goto' poll
Quite a few languages have "goto" statements and they may or may not be necessary depending on the structure of the language. Every assembly language I ever used had a goto and you needed to use it. There was no way around it. I believe Basic has a necessary goto also (I have very little experience with Basic). I can't remember if Fortran does or not (I haven't even seen Fortran since my college days).
Goto is a part of C (and C++), but the structure of the language makes it unnecessary except for handling some extreme error conditions. The language has a better way of writing a program.
There is some dogmatism about goto in C and C++, but there are some practical reasons for it too. Not only is a program listing more readable by a human without gotos, but I don't believe modern optimizing compilers won't optimize code with a lot of gotos very well, which will make the program run slower.
-
December 16th, 2004, 08:08 AM
#9
Re: The grand 'goto' poll
Hello??? Someone right there?
Mmmmm... long time this thread has been inactive... and has not come to Holy War... maybe it did while I was away and then they were all nuked and no one survived to discuss gotos...
Mmmm... I'm getting bored...
This poll was getting SO good. Maybe we can restart this thread and get much more fun...
Oh! I know how to do that:
Code:
goto "The grand 'goto' poll"
You're not watching "24"?
Well... you should.
24
Jack IS back...
-
December 16th, 2004, 10:15 AM
#10
Re: The grand 'goto' poll
Originally Posted by TDM
Just as a side note. I performed a search on my entire VC++.NET directory for goto and it returned 2287 hits.
It just seems to be "non-optimized code, that is specifically designed for debugging purposes only. Have you find a single goto in any sample code available in MSDN?
The required binaries, which are linked in Release mode, must not be having any gotos at all...
-
December 16th, 2004, 08:20 PM
#11
Re: The grand 'goto' poll
There may be reasons to use goto in C, where you don't have exception handling, but in C++ you do and they should be used instead.
In C, the "goto" would actually replace the "throw" in C++ and the label would be the start of the "catch" block in C++.
You can think of it as a poor-man's exception, as there are obviously clear limitations.
-
December 17th, 2004, 04:46 AM
#12
Re: The grand 'goto' poll
Originally Posted by NMTop40
In C, the "goto" would actually replace the "throw" in C++ and the label would be the start of the "catch" block in C++.
Of course, C also used the rather frightening setjmp and longjmp for the same purpose. They always scared the **** out of me. I never used them once....
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
December 17th, 2004, 03:16 AM
#13
Re: The grand 'goto' poll
Originally Posted by Ajay Vijay
It just seems to be "non-optimized code, that is specifically designed for debugging purposes only. Have you find a single goto in any sample code available in MSDN?
Yes, I unfortunately did...
The required binaries, which are linked in Release mode, must not be having any gotos at all...
Err...the binaries won't contain any C++ keyword, you know...If the symbols are stripped (as they normally are in release builds) then you won't see them either.
-
December 17th, 2004, 05:18 AM
#14
Re: The grand 'goto' poll
Gabriel,
I meant that release versions of binaries (mfc42.dll, msvcrt.dll, ....) WAS not built using any 'gotos', and the source available to us is non-optimized one.
Also I want to know where you became unfortunate?
-
December 17th, 2004, 05:26 AM
#15
Re: The grand 'goto' poll
CDocManager::OnDDECommand(...) has quite a few goto's dotted about. In fact, even DllMain(..) in DllModul.cpp has a couple.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|