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 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

    F Offline
    F Offline
    fboule
    wrote on last edited by
    #35

    My opinion in using gotos is like C programming: it is up to the programmer to code properly. Some are so skilled to write ugly C code. If used properly, goto can could may might have a place in our hearts. E.g. the MS-DOS batch script below (tested on WinXP):

    @echo off
    set i=0
    

    :loop
    set /a i=%i%+1
    echo Loop %i%
    if not %i% == 10 goto :loop

    R 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
      Marc Clifton
      wrote on last edited by
      #36

      As in "go to h***" when I see someone using goto. Marc

      Thyme In The Country Interacx My Blog

      1 Reply Last reply
      0
      • G Graham Bradshaw

        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 Offline
        G Offline
        Graham Shanks
        wrote on last edited by
        #37

        Graham Bradshaw wrote:

        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.

        By that reckoning anyone using an if ... then ... else is also using a goto. The argument is not that "jump" statements in a program are not required (in any non-trivial program they are unavoidable), but that structured programming constructs rather than the goto statment lead to more understandable programs. As Dijkstra said in his original letter[^] - "The go to statement as it stands is just too primitive, it is too much an invitation to make a mess of one's program." I haven't used a goto statement since I gave up programming in Basic

        Graham Software gets slower faster than hardware gets faster - Nicklaus Wirth

        1 Reply Last reply
        0
        • M Mustafa Ismail Mustafa

          So rare that its basically extinct?

          "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

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

          Again, not really. I've encountered situations (even recently) where I felt that a few goto statements will save me from writing a buttload of ugly nested if-if-if statements.

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

          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

            G Offline
            G Offline
            Gene OK
            wrote on last edited by
            #39

            Doesn't bother me at all to use goto. I haven't found a c++ compiler that doesn't support them. They're not evil, just one more programming construct. If it saves me 100 or 10 or even one line of code, I'll use a goto without thinking twice.

            CodeWiz51 -- Life is not a spectator sport. I came to play. Code's Musings | Code's Articles

            1 Reply Last reply
            0
            • F fboule

              My opinion in using gotos is like C programming: it is up to the programmer to code properly. Some are so skilled to write ugly C code. If used properly, goto can could may might have a place in our hearts. E.g. the MS-DOS batch script below (tested on WinXP):

              @echo off
              set i=0
              

              :loop
              set /a i=%i%+1
              echo Loop %i%
              if not %i% == 10 goto :loop

              R Offline
              R Offline
              Rage
              wrote on last edited by
              #40

              fboule wrote:

              the MS-DOS batch script below

              If under XP, then use a for loop to do that.

              ~RaGE();

              I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
              Do not feed the troll ! - Common proverb

              F 1 Reply Last reply
              0
              • P Philip Laureano

                Vikram A Punathambekar wrote:

                Rule #1: Don't use goto. Rule #2: Know when to break Rule #1.

                Rule #3: Never goto #2.

                Do you know...LinFu?

                R Offline
                R Offline
                Robert Rohde
                wrote on last edited by
                #41

                Philip Laureano wrote:

                Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Rule #3: Never goto #2.

                Do you like recursion? :) Rule #4: Know when to break Rule #3. Rule #5: Never goto #4 Rule #6: Know when to break Rule #5. ... Robert

                S 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

                  O Offline
                  O Offline
                  Oakman
                  wrote on last edited by
                  #42

                  "Switch" is just "on x GOTO" so, yeah, all the time.

                  Jon Smith & Wesson: The original point and click interface

                  1 Reply Last reply
                  0
                  • L leppie

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

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

                    R Offline
                    R Offline
                    Roger Alsing 0
                    wrote on last edited by
                    #43

                    In periods or on a weekly basis?

                    My Blog

                    L 1 Reply Last reply
                    0
                    • R Roger Alsing 0

                      In periods or on a weekly basis?

                      My Blog

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

                      Apply as needed :) (once in 6 months or so).

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

                      1 Reply Last reply
                      0
                      • L leppie

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

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

                        B Offline
                        B Offline
                        BadKarma
                        wrote on last edited by
                        #45

                        Burn him, he is a witch ;P

                        Learn from the mistakes of others, you may not live long enough to make them all yourself.

                        L 1 Reply Last reply
                        0
                        • R Rajesh R Subramanian

                          Again, not really. I've encountered situations (even recently) where I felt that a few goto statements will save me from writing a buttload of ugly nested if-if-if statements.

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

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

                          Rajesh R Subramanian wrote:

                          if-if-if statements

                          Wouldn't evaluating an expression upfront to a variable and then using a switch-case provide an elegant in that case?

                          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

                          R 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
                            Jamie Nordmeyer
                            wrote on last edited by
                            #47

                            The only time I've ever used goto was in the QBasic days, and in Visual Basic when I was first learning that language. I've never used it in any C flavor language, and never allow it when doing code reviews at work.

                            Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan Portland, Oregon, USA

                            1 Reply Last reply
                            0
                            • V Vasudevan Deepak Kumar

                              Rajesh R Subramanian wrote:

                              if-if-if statements

                              Wouldn't evaluating an expression upfront to a variable and then using a switch-case provide an elegant in that case?

                              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

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

                              1. switch works only with integral types and so it cannot be used everywhere. 2. switch uses goto internally.

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

                              D 1 Reply Last reply
                              0
                              • B BadKarma

                                Burn him, he is a witch ;P

                                Learn from the mistakes of others, you may not live long enough to make them all yourself.

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

                                And now I will turn you into a frog! POOF!

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

                                B 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

                                  B Offline
                                  B Offline
                                  BadKarma
                                  wrote on last edited by
                                  #50

                                  under any circumstance use goto I use the following

                                  #define BeamMeUp(_goto) goto _goto
                                  
                                  int AtPlanet()
                                  {
                                  bool bToDangerous = true;
                                  
                                  if(bToDangerous)
                                    BeamMeUp(scotty);
                                  else
                                    Fight();
                                  
                                  scotty:
                                    return ToEnterprise();
                                  
                                  }
                                  

                                  Learn from the mistakes of others, you may not live long enough to make them all yourself.

                                  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
                                    leckey 0
                                    wrote on last edited by
                                    #51

                                    Goto's are evil and real programmers never use them.

                                    Shhhhh..... http://craptasticnation.blogspot.com/[^]

                                    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
                                      Ri Qen Sin
                                      wrote on last edited by
                                      #52

                                      I use label: … goto label whenever I have to use while (true) { … }

                                      So the creationist says: Everything must have a designer. God designed everything. I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?

                                      J 1 Reply Last reply
                                      0
                                      • R Robert Rohde

                                        Philip Laureano wrote:

                                        Rule #1: Don't use goto. Rule #2: Know when to break Rule #1. Rule #3: Never goto #2.

                                        Do you like recursion? :) Rule #4: Know when to break Rule #3. Rule #5: Never goto #4 Rule #6: Know when to break Rule #5. ... Robert

                                        S Offline
                                        S Offline
                                        Steve Hansen
                                        wrote on last edited by
                                        #53

                                        To learn recursion you first need to know recursion!

                                        1 Reply Last reply
                                        0
                                        • L leppie

                                          And now I will turn you into a frog! POOF!

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

                                          B Offline
                                          B Offline
                                          BadKarma
                                          wrote on last edited by
                                          #54

                                          Thanks allot leppie :mad: now i'm forced to make jumps :laugh:

                                          Learn from the mistakes of others, you may not live long enough to make them all yourself.

                                          L enhzflepE 2 Replies 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