The grand 'goto' poll
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 1 of 9 1234 ... LastLast
Results 1 to 15 of 122

Thread: The grand 'goto' poll

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,239

    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!

  2. #2
    Join Date
    Nov 2003
    Location
    Vienna, Austria
    Posts
    212
    I think once
    All the buzzt
    CornedBee

  3. #3
    Join Date
    Apr 1999
    Posts
    27,427
    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

  4. #4
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    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

  5. #5
    Join Date
    Jan 2004
    Location
    Earth
    Posts
    567
    Just as a side note. I performed a search on my entire VC++.NET directory for goto and it returned 2287 hits.

    TDM

  6. #6
    Join Date
    Jun 2003
    Posts
    188
    I hate them. I support code that uses them to perform loops. It's very confusing to follow.

  7. #7
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,239
    I also use goto for cleanup. In my case I implement both cleaning up and error checking via a #define'd macro which uses goto. It's the only use I've ever found for it - but I do use that macro in every program I write.

  8. #8
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by John E
    I also use goto for cleanup. In my case I implement both cleaning up and error checking via a #define'd macro which uses goto. It's the only use I've ever found for it - but I do use that macro in every program I write.
    Me too. I only use goto for cleanup/error handling (jumping downwards, never upwards). This is (according to me) a good, defensive programming style.

  9. #9
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    I don't recall using a "go to" anytime in the past 30 years except when the language (not C/C++) requires it to do what needs to be done, such as "On Error GoTo" in VB. I have never, ever used a goto in C or C++.

    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.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  10. #10
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by j0nas
    Me too. I only use goto for cleanup/error handling (jumping downwards, never upwards). This is (according to me) a good, defensive programming style.
    I think for error handling try/catch provides equivalent capability and most C++ programmers would use try/catch.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  11. #11
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    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.


    Indeed a very good request, I would be interested in these as well...
    Ciao, Andreas

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


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

  12. #12
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    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.
    Well..what did you expect?
    Ciao, Andreas

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


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

  13. #13
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by John E
    I also use goto for cleanup. In my case I implement both cleaning up and error checking via a #define'd macro which uses goto. It's the only use I've ever found for it - but I do use that macro in every program I write.
    Okay...that makes two evil things at the same time...macros and goto's...

    As being pointed out, for error handling there are much better techniques than using 'goto' - of course this is only my view of the thing...
    Ciao, Andreas

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


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

  14. #14
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by Andreas Masur
    As being pointed out, for error handling there are much better techniques than using 'goto' - of course this is only my view of the thing...
    Not in C (btw: I don't combine goto:s and macros).

  15. #15
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    Originally posted by Andreas Masur
    Indeed a very good request, I would be interested in these as well...
    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?

    PS. I've already mentioned, in this thread, the product name I'm developing.

Page 1 of 9 1234 ... 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