... ...
Quote:
I felt a great disturbance in the Force, as if millions of voices suddenly cried out in terror "please close this thread".
Printable View
... ...
Quote:
I felt a great disturbance in the Force, as if millions of voices suddenly cried out in terror "please close this thread".
:eek: And I thought the Whitespace language was bad!Quote:
Originally Posted by jfaust
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.Quote:
Originally Posted by TDM
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
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.
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:
Ha ha! Maybe I ought to rename this, "the thread that wouldn't die" :D
People, this is not the chit/chat forum. Please don't post for the sake of it. Thank you.
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?Quote:
Originally Posted by TDM
The required binaries, which are linked in Release mode, must not be having any gotos at all...
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.
Yes, I unfortunately did...;)Quote:
Originally Posted by Ajay Vijay
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.Quote:
The required binaries, which are linked in Release mode, must not be having any gotos at all...
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.
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:Quote:
Originally Posted by NMTop40
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? ;)
CDocManager::OnDDECommand(...) has quite a few goto's dotted about. In fact, even DllMain(..) in DllModul.cpp has a couple.
So? As I said earlier, it is ONLY for debugging purposes...............
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:Quote:
Originally Posted by John E
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.
Though I strongly advice against the use of goto I used it in my code, but only when I did copy/paste from MSDN.Quote:
Originally Posted by ovidiucucu
I'm amazed that this thread is still alive!
I’m one of three that voted “I use goto regularly”. I still do, in C, for (mostly) cleanup purposes. I strive to be pragmatic about programming and therefore use GOTOs for making my code clearer and easier to understand (yes it really increases the readability). I think I’ve tried to explain this before in this thread, but I don’t know if people noticed it. I really don’t like referring to distinguished people when expressing my opinions, but I’m ready to do an exception this time. Please read the following about the use of goto in the Linux kernel:
http://kerneltrap.org/node/553?PHPSE...b19cd0de9711b8
Linus (and others) expresses the usefulness of goto better than I ever will...
That's an interesting thread, and although I don't fully agree with Linus's point of view, I found Scott Robert Ladd's contribution to this subject so valuable and to the point that I would like to reproduce it here.Quote:
Originally Posted by j0nas
Edit: Bolded the most interesting parts.Quote:
Originally Posted by Scott Robert Ladd