The grand 'goto' poll - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

View Poll Results: How often have you used 'goto' in the last 5 years?

Voters
111. You may not vote on this poll
  • I use goto regularly.

    3 2.70%
  • I use goto occasionally.

    8 7.21%
  • I've used goto VERY occasionally.

    34 30.63%
  • I've never used goto at all.

    66 59.46%
Page 2 of 9 FirstFirst 12345 ... LastLast
Results 16 to 30 of 122

Thread: The grand 'goto' poll

  1. #16
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by Sam Hobbs
    If you don't understand the disadvantages of a goto then it is unlikely anyone can explain them. The disadvantages of a goto are not clear when considering it alone. The disadvantages are very clear when considering it in the context of a methodology such as Structured Programming.
    Hallelulja. Yet another Pascal brainwashed statement

    Sorry Sam, but I still don't understand why we all dispute about something that is a matter of taste.

  2. #17
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by j0nas
    Not in C (btw: I don't combine goto:s and macros).
    Well...I did not especially refer to C++ exception handling in my previous post since this is indeed not available in C (although there are some kind of simulated exception handling).

    Nevertheless, I still would not do my error handling with 'goto' - even if it would be C.

    Anyway...this topic is pretty subjective...there are many who do use 'goto' - others not. It should have become obvious that I belong to the latter group. However, that does not mean that I make fun of anybody who uses it or think their applications are bad. It is just that I do not see any advantages of using 'goto' in my applications...
    Last edited by Andreas Masur; February 15th, 2004 at 01:12 PM.
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  3. #18
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by j0nas
    What do you and others find interesting in knowing that? Do you think source codes that have goto:s in them are bad software or what?
    I can only speak for myself here...the statement from Paul made me smile since I pretty much assume why he stated it.

    Nevertheless, due to the nature of 'goto' (breaking the application flow completely), getting the application to a point where it is generally called 'bug-free' is much harder than using no 'goto' at all. I do not say, that it is impossible, however, many programmer's simply write something together, implementing a 'goto' here, a 'goto there, and test the application for five minutes. The problems arise if this application is used for more than five minutes. Many of these kind of programmers are not even closely aware of the problems 'goto' can produce and are not even capable of thinking through all the side effects your application can get while jumping back and forth in it.

    I do not say that is the case with everyone using 'goto'. As with any other construct, using 'goto' in a "safe" way can be done as well and for these kind of programmers my above example does not fit of course...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  4. #19
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by j0nas
    Sorry Sam, but I still don't understand why we all dispute about something that is a matter of taste.
    Well...that is exactly the same thing with all these kind of other discussions of this type...like is Windows better than Linux or is C++ better than Java etc.

    People always will get attracted by these...and if the discussion stays in normal ways (not a religious one) then it is okay - at least in my eyes. It is always interesting to see why other people uses something that you do not use for your own reasons...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  5. #20
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235
    Yes, I didn't intend this thread to become a slanging match. But just to add something....

    Originally posted by Sam Hobbs
    I think for error handling try/catch provides equivalent capability
    In many ways, I'd go further than that Sam and say that try, catch & throw provide superior capability - not the least of which is the ability to throw different types of exception. However, the problem with 'throw' is that you never quite know where it's going to end up. It's very easy to end up with memory leaks and other problems by not catching exceptions soon enough - and, just like goto, there are no compiler warnings to help you if you don't use them sensibly. Furthermore, I've been on the wrong side of a couple of documentation errors where the thrown exception was not of the type described. This can cause real problems.

    I'm not knocking try, catch & throw. I use them myself quite often - but IMHO it's just as easy to get into trouble with try, catch & throw as it is with goto. In fact, what is a 'throw'? Isn't it just a 'goto' with an unknown destination??

  6. #21
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by j0nas
    Do you think source codes that have goto:s in them are bad software or what?
    I don't know but I think it would be interesting to determine the reliability of software that uses gotos compared to software that does not.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  7. #22
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by John E
    I'm not knocking try, catch & throw. I use them myself quite often - but IMHO it's just as easy to get into trouble with try, catch & throw as it is with goto. In fact, what is a 'throw'? Isn't it just a 'goto' with an unknown destination??
    Well...'throw' does not have an unknown destination...it's destination is always the next 'catch' statement. Nevertheless, I agree that you can get into trouble with the exception handling as well.

    However, that is basically one reason why experienced exception handling people do get a well payment each month...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  8. #23
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by Sam Hobbs
    I don't know but I think it would be interesting to determine the reliability of software that uses gotos compared to software that does not.
    Well..I would not necessarely say that software that uses 'goto' is less reliable than software not using 'goto'.

    The more interesting question in my eyes would rather be: How long did it take you to get the software using 'goto' as reliable?
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  9. #24
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by j0nas
    Hallelulja. Yet another Pascal brainwashed statement
    Structured Programming is not the result of Pascal; Pascal is the result of Structured Programming. The original Basic language used gotos so much that Pascal was designed to show that a compiler could be small and efficient yet still process a language that supported Structured Programming. Yes, Pascal was definitely designed to be a direct implentation of Structured Programming. However Structured Programming definitely existed before Pascal. Structured Programming became popular in the mid-1970's.
    Originally posted by j0nas
    Sorry Sam, but I still don't understand why we all dispute about something that is a matter of taste.
    This is the type of thing that often "baits" peopl into disputes. Where did I dispute it? I think I made it clear that it is not worth disputing. Yes I said that there are disadvantages of using gotos when considered in the context of a methodology but I intended to say that outside such a context and in a context such as in this discussion it is not worth disputing, and I will avoid getting baited in this manner into a dispute.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  10. #25
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by Andreas Masur
    Well..I would not necessarely say that software that uses 'goto' is less reliable than software not using 'goto'.
    Read what I said again! I did not say that software that uses gotos are less reliable.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  11. #26
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by Andreas Masur
    Well...that is exactly the same thing with all these kind of other discussions of this type...like is Windows better than Linux or is C++ better than Java etc.

    People always will get attracted by these...and if the discussion stays in normal ways (not a religious one) then it is okay - at least in my eyes. It is always interesting to see why other people uses something that you do not use for your own reasons...
    Yes, I fully agree that it is interesting to hear other people's opinions. But, several times in this thread, I've read things like:
    • "If you don't understand the disadvantages of a goto then it is unlikely anyone can explain them."
    • "...getting the application to a point where it is generally called 'bug-free' is much harder than using no 'goto' at all."
    • "Please tell us the name of your software product(s) where you have used goto regularly."

    which, of course, are anonsense. The first statement is insulting (to me). The second statement is a personal view of something that you don't know for sure. The third statement is irrelevant.

    /Jonas--the "goto" man!

  12. #27
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    eh maybe we should have a poll where you can't make responses to it Just the voting part ....

    /Sits back with the popcorn for yet another goto thread....

  13. #28
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    btw: I'm on the, never used goto, never saw the need to...but I never rule anything out...

  14. #29
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by j0nas
    The first statement is insulting (to me).
    I am sorry. Perhaps you are taking things too seriously. I think what I said is within the realm of friendly discussion. People can disagree and I think within the context of disagreeing it is reasonable to say what I said. I am sorry that I did not make it clear that you can disagree.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  15. #30
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by Sam Hobbs
    I don't know but I think it would be interesting to determine the reliability of software that uses gotos compared to software that does not.
    Hmm... Yes, me too. How would such test/research be lead? Methods to use and so on...

    I'm guessing the product I'm developing has reliability by our customers. It's a security product

Page 2 of 9 FirstFirst 12345 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center