Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. do you use goto? [modified]

do you use goto? [modified]

Scheduled Pinned Locked Moved The Lounge
phphtmldatabaseoraclecom
65 Posts 41 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Patrick Klug
    wrote on last edited by
    #1

    Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

    Listen to the toad! www.dotnettoad.com[^]

    modified on Monday, May 19, 2008 4:44 AM

    C V P D R 30 Replies Last reply
    0
    • P Patrick Klug

      Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

      Listen to the toad! www.dotnettoad.com[^]

      modified on Monday, May 19, 2008 4:44 AM

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I've never used goto, not once in 8 years of being paid for my code. More important, I've never once written code where I set out to avoid a use of goto. I've seen where it's used in error handling code, and it seems valid enough to me there, but I've alwaysh handled errors differently, and never felt that goto would make my code more readable. I've removed my share of gotos from code, I've never written one.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      P G 2 Replies Last reply
      0
      • C Christian Graus

        I've never used goto, not once in 8 years of being paid for my code. More important, I've never once written code where I set out to avoid a use of goto. I've seen where it's used in error handling code, and it seems valid enough to me there, but I've alwaysh handled errors differently, and never felt that goto would make my code more readable. I've removed my share of gotos from code, I've never written one.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        P Offline
        P Offline
        Patrick Klug
        wrote on last edited by
        #3

        my story is similar. Never used it but as I said my team mate has. According to my observation its more a way of thinking than anything else.

        Listen to the toad! www.dotnettoad.com[^]

        V 1 Reply Last reply
        0
        • P Patrick Klug

          Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

          Listen to the toad! www.dotnettoad.com[^]

          modified on Monday, May 19, 2008 4:44 AM

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          There should be a strong signage indicating "Use GoTo. GoTo Hell". Nothing to offend. But the catch is even while trivially using GOTO, we indirectly encourage new programmers following into the trap and then their laziness would make them succumb to that bad habit.

          Vasudevan Deepak Kumar Personal Homepage
          Tech Gossips
          A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

          1 Reply Last reply
          0
          • P Patrick Klug

            my story is similar. Never used it but as I said my team mate has. According to my observation its more a way of thinking than anything else.

            Listen to the toad! www.dotnettoad.com[^]

            V Offline
            V Offline
            Vasudevan Deepak Kumar
            wrote on last edited by
            #5

            Pakl wrote:

            my team mate has

            We should encourage them to discourage themselves using GOTOs.

            Vasudevan Deepak Kumar Personal Homepage
            Tech Gossips
            A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

            P 1 Reply Last reply
            0
            • V Vasudevan Deepak Kumar

              Pakl wrote:

              my team mate has

              We should encourage them to discourage themselves using GOTOs.

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

              P Offline
              P Offline
              Patrick Klug
              wrote on last edited by
              #6

              not an easy task... I fought the fight and I think he doesn't use it as often anymore but the cost was not worth it (in retrospective) - it is hard to change peoples opinion on something like that.

              Listen to the toad! www.dotnettoad.com[^]

              V 1 Reply Last reply
              0
              • P Patrick Klug

                not an easy task... I fought the fight and I think he doesn't use it as often anymore but the cost was not worth it (in retrospective) - it is hard to change peoples opinion on something like that.

                Listen to the toad! www.dotnettoad.com[^]

                V Offline
                V Offline
                Vasudevan Deepak Kumar
                wrote on last edited by
                #7

                Pakl wrote:

                it is hard to change peoples opinion on something like that

                Very hard to convince certain people. Sometimes we end up hitting or burning their ego and they would show a long guerilla face to us, for even trivia things. Certain things we should just ignore it off for the sake of team spirit, seamless cum systematic deliverables and benefit of the organization.

                Vasudevan Deepak Kumar Personal Homepage
                Tech Gossips
                A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                1 Reply Last reply
                0
                • P Patrick Klug

                  Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                  Listen to the toad! www.dotnettoad.com[^]

                  modified on Monday, May 19, 2008 4:44 AM

                  P Offline
                  P Offline
                  phannon86
                  wrote on last edited by
                  #8

                  I've said this before, but I was always told to avoid it. Back at uni, you lost 50 marks (of 100) for every use of goto. He never explained further as to why, other than it creates "spaghetti code", no particular justifications. But I've never used it and have never felt the need to.

                  He who makes a beast out of himself gets rid of the pain of being a man

                  1 Reply Last reply
                  0
                  • P Patrick Klug

                    Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                    Listen to the toad! www.dotnettoad.com[^]

                    modified on Monday, May 19, 2008 4:44 AM

                    D Offline
                    D Offline
                    Dalek Dave
                    wrote on last edited by
                    #9

                    As a Programming Newbie (still learning C#) I feel I agree with what I read in most of the Textbooks on the Subject. There IS a place for GoTo... It's place is to be found in textbooks, surrounded by the words "You must never use" and the words "in your code, they are messy and unnecessary". :)

                    ------------------------------------ "I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox. "You DO have a blaster in your hand" - Freighter Pilot "Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox

                    1 Reply Last reply
                    0
                    • P Patrick Klug

                      Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                      Listen to the toad! www.dotnettoad.com[^]

                      modified on Monday, May 19, 2008 4:44 AM

                      R Offline
                      R Offline
                      Rocky Moore
                      wrote on last edited by
                      #10

                      Of course, back in the day, I used the Goto to avoid repeated code or huge indentation. That said though with exception handling and what not, I have not "had" to use it in the last decade or so. But I still like the option of it being there just in case.

                      Rocky <>< Blog Post: Handy utility app that is always on my machines! Tech Blog Post: Microsoft Live Writer Plug-ins!

                      D 1 Reply Last reply
                      0
                      • R Rocky Moore

                        Of course, back in the day, I used the Goto to avoid repeated code or huge indentation. That said though with exception handling and what not, I have not "had" to use it in the last decade or so. But I still like the option of it being there just in case.

                        Rocky <>< Blog Post: Handy utility app that is always on my machines! Tech Blog Post: Microsoft Live Writer Plug-ins!

                        D Offline
                        D Offline
                        Dalek Dave
                        wrote on last edited by
                        #11

                        Back in the Day? I used them on ZX Spectrums and BBC's but that was because there was little choice. (Okay, gosub, but that was little better). You could, though, have some control of Goto (as it was spelt then) by use of flags, but it was very crude and nasty. Some things DO improve.

                        ------------------------------------ "I want you to imagine I have a blaster in my hand" - Zaphod Beeblebrox. "You DO have a blaster in your hand" - Freighter Pilot "Yeah, so you don't have to tax your imagination too hard" - Zaphod Beeblebrox

                        1 Reply Last reply
                        0
                        • P Patrick Klug

                          Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                          Listen to the toad! www.dotnettoad.com[^]

                          modified on Monday, May 19, 2008 4:44 AM

                          A Offline
                          A Offline
                          Alsvha
                          wrote on last edited by
                          #12

                          A few times for some testing/debuging purpose when I wanted to bypass code blocks. Never in production code (although I do feel it could be fun to litter some code with it, just for the heck of it :D)

                          --------------------------- Blogging about SQL, Technology and many other things

                          M 1 Reply Last reply
                          0
                          • P Patrick Klug

                            Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                            Listen to the toad! www.dotnettoad.com[^]

                            modified on Monday, May 19, 2008 4:44 AM

                            M Offline
                            M Offline
                            Mustafa Ismail Mustafa
                            wrote on last edited by
                            #13

                            A wise man once told me that if I used goto (and this was back during the day) then I had to rethink my solution. He was right.

                            "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "You're an idiot." John Simmons, THE Outlaw programmer "I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon

                            V R 2 Replies Last reply
                            0
                            • M Mustafa Ismail Mustafa

                              A wise man once told me that if I used goto (and this was back during the day) then I had to rethink my solution. He was right.

                              "Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed. Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler "You're an idiot." John Simmons, THE Outlaw programmer "I realised that all of my best anecdotes started with "So there we were, pissed". Pete O'Hanlon

                              V Offline
                              V Offline
                              Vasudevan Deepak Kumar
                              wrote on last edited by
                              #14

                              Rephrasing it, "

                              If you plan using GOTO, you ought to GO-BACK and think again

                              ".

                              Vasudevan Deepak Kumar Personal Homepage
                              Tech Gossips
                              A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

                              L 1 Reply Last reply
                              0
                              • P Patrick Klug

                                Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                                Listen to the toad! www.dotnettoad.com[^]

                                modified on Monday, May 19, 2008 4:44 AM

                                L Offline
                                L Offline
                                leppie
                                wrote on last edited by
                                #15

                                Hi, my name is leppie, and I use goto occasionally.

                                xacc.ide - now with TabsToSpaces support
                                IronScheme - 1.0 alpha 3 out now

                                R B 2 Replies Last reply
                                0
                                • P Patrick Klug

                                  Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                                  Listen to the toad! www.dotnettoad.com[^]

                                  modified on Monday, May 19, 2008 4:44 AM

                                  D Offline
                                  D Offline
                                  Dario Solera
                                  wrote on last edited by
                                  #16

                                  I used it, but it was for a good cause. No, wait. It was because the language I was working with did not have cycle constructs. :doh:

                                  If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

                                  1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    I've never used goto, not once in 8 years of being paid for my code. More important, I've never once written code where I set out to avoid a use of goto. I've seen where it's used in error handling code, and it seems valid enough to me there, but I've alwaysh handled errors differently, and never felt that goto would make my code more readable. I've removed my share of gotos from code, I've never written one.

                                    Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                                    G Offline
                                    G Offline
                                    Graham Bradshaw
                                    wrote on last edited by
                                    #17

                                    Christian Graus wrote:

                                    I've never used goto

                                    Not explicitly, anyway. If you've ever used a C break or continue, implicitly you have, since break and continue are simply goto's with an implicit label that is just outside or inside the current end of scope.

                                    G 1 Reply Last reply
                                    0
                                    • P Patrick Klug

                                      Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                                      Listen to the toad! www.dotnettoad.com[^]

                                      modified on Monday, May 19, 2008 4:44 AM

                                      J Offline
                                      J Offline
                                      Jorgen Andersson
                                      wrote on last edited by
                                      #18

                                      I don't use Goto and I get rashes when I see one. So, how about Exit/Break? Is that justifiable?

                                      L 1 Reply Last reply
                                      0
                                      • A Alsvha

                                        A few times for some testing/debuging purpose when I wanted to bypass code blocks. Never in production code (although I do feel it could be fun to litter some code with it, just for the heck of it :D)

                                        --------------------------- Blogging about SQL, Technology and many other things

                                        M Offline
                                        M Offline
                                        Mycroft Holmes
                                        wrote on last edited by
                                        #19

                                        Alsvha wrote:

                                        although I do feel it could be fun to litter some code with it, just for the heck of it

                                        There is an evil person in there somewhere. If I found one of my guys using a Goto I'd haul them out into the light and display it a a case of what NOT to do. I thought it had been retired when we went to .net and was disgusted to see that it is in C#, and I thought VB was the only language inflicted with the bloody Goto.

                                        Never underestimate the power of human stupidity RAH

                                        1 Reply Last reply
                                        0
                                        • P Patrick Klug

                                          Hey guys, My former team mate used goto's quite often (to my despair). I just published a small post on when to (not) use goto on my blog[^] where I try to look at this in a pragmatic way. I am interested if you are using goto's (or know someone who does?). Opinions? cheers, Pakl PS: This is just a blunt advertisment for my blog so I can lure you into it and become rich and famous. :-\

                                          Listen to the toad! www.dotnettoad.com[^]

                                          modified on Monday, May 19, 2008 4:44 AM

                                          R Offline
                                          R Offline
                                          Rajesh R Subramanian
                                          wrote on last edited by
                                          #20

                                          In a situation like this[^], I *will* use goto. And yes, I know what I'm doing.

                                          Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                                          M 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups