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. Bizarre code

Bizarre code

Scheduled Pinned Locked Moved The Lounge
30 Posts 16 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.
  • J JWood

    Yeh I hate stuff like that. Some people don't understand there are certain rules of decorum when programming - In a dinner time analogy This is like spitting chicken bones into the centerpiece.

    R Offline
    R Offline
    realJSOP
    wrote on last edited by
    #20

    Hell, *I've* done that! :) ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

    1 Reply Last reply
    0
    • R Richard Stringer

      John Simmons / outlaw programmer wrote: more rare than the use of "goto" (evil code if ever there was some). There are good reasons for leaving the GOTO keyword in any all purpose language. I'll leave "why" as an exercise for the reader but check out "throw" and "catch". Richard In a world of pollution, profanity, adolescence, zits, broccoli, racism, ozone depletion, sexism, stupid guys, and PMS, why the hell do people still tell me to have a nice day? --Unknown

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #21

      Nope, I've never used a goto in C++ (although I have removed a few). There's never a "good reason" to use one. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      R 1 Reply Last reply
      0
      • R realJSOP

        Yeah I know - I've been doing C++ for over 15 years, and I've never seen it used before - ever. In fact, that's probably more rare than the use of "goto" (evil code if ever there was some). I would say this line of code is pretty bad form. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        N Offline
        N Offline
        Nemanja Trifunovic
        wrote on last edited by
        #22

        1. Explicitelly calling destructor is very common in cases of implementing reference-counting schemas. I have never implemented such a thing myself, but I have seen it many times. Nothing wrong about that. 2. goto is sometimes the cleanest technique to get out of a nested loop. You just got to be sure there are no allocations within these loops, or you may end up with a leak.


        My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

        N 1 Reply Last reply
        0
        • R realJSOP

          Yeah I know - I've been doing C++ for over 15 years, and I've never seen it used before - ever. In fact, that's probably more rare than the use of "goto" (evil code if ever there was some). I would say this line of code is pretty bad form. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          A Offline
          A Offline
          Anna Jayne Metcalfe
          wrote on last edited by
          #23

          The only time I've seen a direct call to a destructor is in template framework code. I've not used a goto since I moved from Basic and Z-80 assembler to Pascal (and thence to C and C++). :) Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

          1 Reply Last reply
          0
          • R realJSOP

            Nope, I've never used a goto in C++ (although I have removed a few). There's never a "good reason" to use one. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            R Offline
            R Offline
            Richard Stringer
            wrote on last edited by
            #24

            There is code that you dimply can't write without it. But I guess outlaws are special. There is absolutly nothing wrong , bad, or incorrect about a goto. Much more mayhem has been invoked in using memory allocation than with the use of goto. Urban legend stuff you know. Richard In a world of pollution, profanity, adolescence, zits, broccoli, racism, ozone depletion, sexism, stupid guys, and PMS, why the hell do people still tell me to have a nice day? --Unknown

            1 Reply Last reply
            0
            • B bevpet

              i'll swap you your m_pPropertySheet->~CMyPropertySheet(); for my :doh::doh: monther-in-law :doh: and day of the week :wtf: bring on your goto's also :wtf: no code is as bad as :omg::wtf: "the mother-in-law" :wtf::omg:

              S Offline
              S Offline
              S Douglas
              wrote on last edited by
              #25

              bevpet wrote: no code is as bad as "the mother-in-law" :sigh: I know that feeling... -------------------------------

              1 Reply Last reply
              0
              • M Member 96

                Really? That's surprising, I thought you were a working programmer not a hobbyist? I'll admit it's rare, but I can't think of any major commercial application of consequence I've worked on that didn't have at least one area with a goto in it (both in c++ and now c#) that was better done any other way. (sure I could have invented a convoluted way to avoid it but why bother? It's a tool there to be used in the right circumstances.)


                "In our civilization, and under our republican form of government, intelligence is so highly honored that it is rewarded by exemption from the cares of office." - Ambrose Bierce

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

                John Cardinal wrote: Really? That's surprising, I thought you were a working programmer not a hobbyist? ROTFL. I am a dual duty pulling working programmer in C++ and C#, for many years, and I am yet to even consider 'goto', although in C++ there were times that I avoided 'goto' by giving it some thought ( and no, the solution was not convoluted, hard to read, or in any way less preferable to a 'goto' solution. Christian Graus - Microsoft MVP - C++

                M 1 Reply Last reply
                0
                • N Nemanja Trifunovic

                  1. Explicitelly calling destructor is very common in cases of implementing reference-counting schemas. I have never implemented such a thing myself, but I have seen it many times. Nothing wrong about that. 2. goto is sometimes the cleanest technique to get out of a nested loop. You just got to be sure there are no allocations within these loops, or you may end up with a leak.


                  My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                  N Offline
                  N Offline
                  Nish Nishant
                  wrote on last edited by
                  #27

                  Nemanja Trifunovic wrote: 1. Explicitelly calling destructor is very common in cases of implementing reference-counting schemas. I have never implemented such a thing myself, but I have seen it many times. Nothing wrong about that. Yep; before I read your post, I knew you'd have a proper answer, Nemanja :-)

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    John Cardinal wrote: Really? That's surprising, I thought you were a working programmer not a hobbyist? ROTFL. I am a dual duty pulling working programmer in C++ and C#, for many years, and I am yet to even consider 'goto', although in C++ there were times that I avoided 'goto' by giving it some thought ( and no, the solution was not convoluted, hard to read, or in any way less preferable to a 'goto' solution. Christian Graus - Microsoft MVP - C++

                    M Offline
                    M Offline
                    Member 96
                    wrote on last edited by
                    #28

                    Well that may be but I have better things to do with my time than find ways to avoid using an important language tool at my disposal for nothing more than superstition. ;)


                    "In our civilization, and under our republican form of government, intelligence is so highly honored that it is rewarded by exemption from the cares of office." - Ambrose Bierce

                    C 1 Reply Last reply
                    0
                    • M Member 96

                      Well that may be but I have better things to do with my time than find ways to avoid using an important language tool at my disposal for nothing more than superstition. ;)


                      "In our civilization, and under our republican form of government, intelligence is so highly honored that it is rewarded by exemption from the cares of office." - Ambrose Bierce

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

                      I guess it depends on how old you are - although I used goto plenty in the 80s. I just don't see it as an 'important tool', I see it as an obsfucation tool. I'd probably be less pedantic now, if I saw a genuine need for it, but as I said, I've written plenty of C# code without ever seeing it as an option. I prefer code to be structured, and probably C# exception handling does stuff for me that you would use goto for. ( although, I think that try/catch is essentially goto a lot of the time anyhow ) Christian Graus - Microsoft MVP - C++

                      M 1 Reply Last reply
                      0
                      • C Christian Graus

                        I guess it depends on how old you are - although I used goto plenty in the 80s. I just don't see it as an 'important tool', I see it as an obsfucation tool. I'd probably be less pedantic now, if I saw a genuine need for it, but as I said, I've written plenty of C# code without ever seeing it as an option. I prefer code to be structured, and probably C# exception handling does stuff for me that you would use goto for. ( although, I think that try/catch is essentially goto a lot of the time anyhow ) Christian Graus - Microsoft MVP - C++

                        M Offline
                        M Offline
                        Member 96
                        wrote on last edited by
                        #30

                        I've been programming since the assembly language cartridge came out for the Radio Shack TRS 80 colour computer. But I was writing basic before that on paper before I had access to a computer. I still think it's just superstition to not use it though and my code is not reviewed by anyone at the source level so I can do whatever works best without fear of getting into "holy wars" about it. :-D


                        "In our civilization, and under our republican form of government, intelligence is so highly honored that it is rewarded by exemption from the cares of office." - Ambrose Bierce

                        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