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... :confused:
Mmmm... I'm getting bored...
This poll was getting SO good. Maybe we can restart this thread and get much more fun... :rolleyes:
Oh! I know how to do that:
Code:
goto "The grand 'goto' poll"
:rolleyes:
Re: The grand 'goto' poll
Ha ha! Maybe I ought to rename this, "the thread that wouldn't die" :D
Re: The grand 'goto' poll
People, this is not the chit/chat forum. Please don't post for the sake of it. Thank you.
Re: The grand 'goto' poll
Quote:
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...
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.
Re: The grand 'goto' poll
Quote:
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...;)
Quote:
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.
Re: The grand 'goto' poll
As long as it exists I've used goto (VERY occasionally).
IMHO: The guys voted I've never used goto at all
- are not sincerely or
- never wrote a program.
;)
Re: The grand 'goto' poll
Quote:
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.... :eek:
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? ;)
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.
Re: The grand 'goto' poll
So? As I said earlier, it is ONLY for debugging purposes...............
Re: The grand 'goto' poll
I must admit, it doesn't look like that to me, Ajay..... The goto's seem to be used for cleanup. Admittedly, there are some aspects of the cleanup code that only apply to the DEBUG version - but only some aspects, not all.
Re: The grand 'goto' poll
Quote:
Originally Posted by John E
I must admit, it doesn't look like that to me, Ajay..... The goto's seem to be used for cleanup. Admittedly, there are some aspects of the cleanup code that only apply to the DEBUG version - but only some aspects, not all.
That's the only thing I was telling since stone age! :cool:
Re: The grand 'goto' poll
Just want to point out that neither the MFC source code nor the MSDN examples are to be seen as 'good C++ programming style'. Thus, the discussion whether goto's are or aren't used in this or that piece of sourcecode is actually irrelevant.
Re: The grand 'goto' poll
Quote:
Originally Posted by ovidiucucu
As long as it exists
I've used goto (VERY occasionally).
IMHO: The guys voted
I've never used goto at all
- are not sincerely or
- never wrote a program.
;)
Though I strongly advice against the use of goto I used it in my code, but only when I did copy/paste from MSDN.