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. Other Discussions
  3. The Weird and The Wonderful
  4. No names, no refences - and not mine.

No names, no refences - and not mine.

Scheduled Pinned Locked Moved The Weird and The Wonderful
beta-testing
26 Posts 19 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.
  • OriginalGriffO OriginalGriff

    Have a look at this little beauty, courtesy of QA:

    ptotal = Double.Parse(Me.txtt1.Text) + Double.Parse(Me.txtt2.Text) + Double.Parse(Me.txtt3.Text) + _
    Double.Parse(Me.txtt4.Text) + Double.Parse(Me.txtt5.Text) + Double.Parse(Me.txtt6.Text) + _
    Double.Parse(Me.txtt7.Text) + Double.Parse(Me.txtt8.Text) + Double.Parse(Me.txtt9.Text) + _
    Double.Parse(Me.txtt10.Text) + Double.Parse(Me.txtt11.Text) + Double.Parse(Me.txtt12.Text) + _
    Double.Parse(Me.txtt13.Text) + Double.Parse(Me.txtt14.Text) + Double.Parse(Me.txtt15.Text) + _
    Double.Parse(Me.txtt16.Text) + Double.Parse(Me.txtt17.Text) + Double.Parse(Me.txtt18.Text) + _
    Double.Parse(Me.txtt19.Text) + Double.Parse(Me.txtt20.Text) + Double.Parse(Me.txtt21.Text) + _
    Double.Parse(Me.txtt22.Text) + Double.Parse(Me.txtt23.Text) + Double.Parse(Me.txtt24.Text) + _
    Double.Parse(Me.txtt25.Text) + Double.Parse(Me.txtt26.Text) + Double.Parse(Me.txtt27.Text) + _
    Double.Parse(Me.txtt28.Text) + Double.Parse(Me.txtt29.Text) + Double.Parse(Me.txtt30.Text) + _
    Double.Parse(Me.txtt31.Text) + Double.Parse(Me.txtt32.Text) + Double.Parse(Me.txtt33.Text) + _
    Double.Parse(Me.txtt34.Text) + Double.Parse(Me.txtt35.Text) + Double.Parse(Me.txtt36.Text) + _
    Double.Parse(Me.txtt37.Text) + Double.Parse(Me.txtt38.Text) + Double.Parse(Me.txtt39.Text) + _
    Double.Parse(Me.txtt40.Text) + Double.Parse(Me.txtt41.Text) + Double.Parse(Me.txtt42.Text) + _
    Double.Parse(Me.txtt43.Text) + Double.Parse(Me.txtt44.Text) + Double.Parse(Me.txtt45.Text) + _
    Double.Parse(Me.txtt46.Text) + Double.Parse(Me.txtt47.Text) + Double.Parse(Me.txtt48.Text) + _
    Double.Parse(Me.txtt49.Text) + Double.Parse(Me.txtt50.Text)

    O.M.G. What else can you do, but gaze upon it's plethora of hideous features...Yes, those are all TextBoxes. :doh:

    The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

    R Offline
    R Offline
    Richard C Bishop
    wrote on last edited by
    #17

    What's wrong with that code? ;P

    OriginalGriffO 1 Reply Last reply
    0
    • R Richard C Bishop

      What's wrong with that code? ;P

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #18

      Remind me never to employ you! :laugh:

      The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      R 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Remind me never to employ you! :laugh:

        The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

        R Offline
        R Offline
        Richard C Bishop
        wrote on last edited by
        #19

        I will just use that code as my resume and the reminding shall occur.

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Have a look at this little beauty, courtesy of QA:

          ptotal = Double.Parse(Me.txtt1.Text) + Double.Parse(Me.txtt2.Text) + Double.Parse(Me.txtt3.Text) + _
          Double.Parse(Me.txtt4.Text) + Double.Parse(Me.txtt5.Text) + Double.Parse(Me.txtt6.Text) + _
          Double.Parse(Me.txtt7.Text) + Double.Parse(Me.txtt8.Text) + Double.Parse(Me.txtt9.Text) + _
          Double.Parse(Me.txtt10.Text) + Double.Parse(Me.txtt11.Text) + Double.Parse(Me.txtt12.Text) + _
          Double.Parse(Me.txtt13.Text) + Double.Parse(Me.txtt14.Text) + Double.Parse(Me.txtt15.Text) + _
          Double.Parse(Me.txtt16.Text) + Double.Parse(Me.txtt17.Text) + Double.Parse(Me.txtt18.Text) + _
          Double.Parse(Me.txtt19.Text) + Double.Parse(Me.txtt20.Text) + Double.Parse(Me.txtt21.Text) + _
          Double.Parse(Me.txtt22.Text) + Double.Parse(Me.txtt23.Text) + Double.Parse(Me.txtt24.Text) + _
          Double.Parse(Me.txtt25.Text) + Double.Parse(Me.txtt26.Text) + Double.Parse(Me.txtt27.Text) + _
          Double.Parse(Me.txtt28.Text) + Double.Parse(Me.txtt29.Text) + Double.Parse(Me.txtt30.Text) + _
          Double.Parse(Me.txtt31.Text) + Double.Parse(Me.txtt32.Text) + Double.Parse(Me.txtt33.Text) + _
          Double.Parse(Me.txtt34.Text) + Double.Parse(Me.txtt35.Text) + Double.Parse(Me.txtt36.Text) + _
          Double.Parse(Me.txtt37.Text) + Double.Parse(Me.txtt38.Text) + Double.Parse(Me.txtt39.Text) + _
          Double.Parse(Me.txtt40.Text) + Double.Parse(Me.txtt41.Text) + Double.Parse(Me.txtt42.Text) + _
          Double.Parse(Me.txtt43.Text) + Double.Parse(Me.txtt44.Text) + Double.Parse(Me.txtt45.Text) + _
          Double.Parse(Me.txtt46.Text) + Double.Parse(Me.txtt47.Text) + Double.Parse(Me.txtt48.Text) + _
          Double.Parse(Me.txtt49.Text) + Double.Parse(Me.txtt50.Text)

          O.M.G. What else can you do, but gaze upon it's plethora of hideous features...Yes, those are all TextBoxes. :doh:

          The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

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

          Absolutely no comments. :wtf:

          "Real men drive manual transmission" - Rajesh.

          1 Reply Last reply
          0
          • M MSHYYC

            Hey, at least with open source you can find that stuff much easier. If a person knows everyone in the world can see the source code they will try to write the best code they can. When the code is hidden things get much worse. One time after much wrangling I was finally able to sign an NDA to gain access the source code to some e-commerce software that a customer was using but had become discontinued. I can completely understand their reluctance--even "on error goto" style exception handling would be better than nothing. And, it being e-commerce it would've been nice if the transactions were atomic. Even if I wasn't legally obligated to keep the identity of the "offender" a secret I probably still would--it just be cruel to mock them; they deserve our pity. I have gained access to closed source via NDA on more than one occasion and horror code has ALWAYS been present and prominent. Every. Single. Time. It is a really big factor in why I do not use closed source software to run my business anymore. It is kind of like how people who have worked in a fast food restaurant chains sometimes stop eating the food there.

            S Offline
            S Offline
            Simon ORiordan from UK
            wrote on last edited by
            #21

            Firstly I'm not dissing Open Source. Just making an observation. I'm quite sure that there is similarly 'bad' code hidden in proprietary. I use nothing but OSS at home(except nvidia) and as much as work will let me, which is why I was trawling the kernel. Besides, the section was in an 'Opened' module which had originally been written as proprietary in the 90s.

            1 Reply Last reply
            0
            • E ENOTTY

              :doh: Actually, jumping out of complicated nested code via goto to an error label is fine in the kernel; what did you expect, setjmp/longjmp? For your enlightenment: http://eli.thegreenplace.net/2009/04/27/using-goto-for-error-handling-in-c/[^]

              S Offline
              S Offline
              Simon ORiordan from UK
              wrote on last edited by
              #22

              It certainly works. But when the labelled line merely sets a return value, it would have been more in keeping with C to use multiple return paths.(Perhaps the code was so old the then-compilers couldn't check multiple paths?)

              E 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Have a look at this little beauty, courtesy of QA:

                ptotal = Double.Parse(Me.txtt1.Text) + Double.Parse(Me.txtt2.Text) + Double.Parse(Me.txtt3.Text) + _
                Double.Parse(Me.txtt4.Text) + Double.Parse(Me.txtt5.Text) + Double.Parse(Me.txtt6.Text) + _
                Double.Parse(Me.txtt7.Text) + Double.Parse(Me.txtt8.Text) + Double.Parse(Me.txtt9.Text) + _
                Double.Parse(Me.txtt10.Text) + Double.Parse(Me.txtt11.Text) + Double.Parse(Me.txtt12.Text) + _
                Double.Parse(Me.txtt13.Text) + Double.Parse(Me.txtt14.Text) + Double.Parse(Me.txtt15.Text) + _
                Double.Parse(Me.txtt16.Text) + Double.Parse(Me.txtt17.Text) + Double.Parse(Me.txtt18.Text) + _
                Double.Parse(Me.txtt19.Text) + Double.Parse(Me.txtt20.Text) + Double.Parse(Me.txtt21.Text) + _
                Double.Parse(Me.txtt22.Text) + Double.Parse(Me.txtt23.Text) + Double.Parse(Me.txtt24.Text) + _
                Double.Parse(Me.txtt25.Text) + Double.Parse(Me.txtt26.Text) + Double.Parse(Me.txtt27.Text) + _
                Double.Parse(Me.txtt28.Text) + Double.Parse(Me.txtt29.Text) + Double.Parse(Me.txtt30.Text) + _
                Double.Parse(Me.txtt31.Text) + Double.Parse(Me.txtt32.Text) + Double.Parse(Me.txtt33.Text) + _
                Double.Parse(Me.txtt34.Text) + Double.Parse(Me.txtt35.Text) + Double.Parse(Me.txtt36.Text) + _
                Double.Parse(Me.txtt37.Text) + Double.Parse(Me.txtt38.Text) + Double.Parse(Me.txtt39.Text) + _
                Double.Parse(Me.txtt40.Text) + Double.Parse(Me.txtt41.Text) + Double.Parse(Me.txtt42.Text) + _
                Double.Parse(Me.txtt43.Text) + Double.Parse(Me.txtt44.Text) + Double.Parse(Me.txtt45.Text) + _
                Double.Parse(Me.txtt46.Text) + Double.Parse(Me.txtt47.Text) + Double.Parse(Me.txtt48.Text) + _
                Double.Parse(Me.txtt49.Text) + Double.Parse(Me.txtt50.Text)

                O.M.G. What else can you do, but gaze upon it's plethora of hideous features...Yes, those are all TextBoxes. :doh:

                The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                C Offline
                C Offline
                Clumpco
                wrote on last edited by
                #23

                Isn't this the original Excel source code?

                L 1 Reply Last reply
                0
                • S Simon ORiordan from UK

                  It certainly works. But when the labelled line merely sets a return value, it would have been more in keeping with C to use multiple return paths.(Perhaps the code was so old the then-compilers couldn't check multiple paths?)

                  E Offline
                  E Offline
                  ENOTTY
                  wrote on last edited by
                  #24

                  Well, this is keeping with kernel C style, since having one exit point is a well established pattern (not only) there; it makes it easier to argue about the correctness no matter eventual compiler warnings.

                  1 Reply Last reply
                  0
                  • C Clumpco

                    Isn't this the original Excel source code?

                    L Offline
                    L Offline
                    Lutoslaw
                    wrote on last edited by
                    #25

                    I don think so. If it was, it would more likely be

                    ptotal = Double.Parse(Me.txttA.Text) + Double.Parse(Me.txttB.Text) + Double.Parse(Me.txttC.Text) + _
                    Double.Parse(Me.txttD.Text) + Double.Parse(Me.txttE.Text) + Double.Parse(Me.txttF.Text) + _
                    Double.Parse(Me.txttG.Text) + Double.Parse(Me.txttH.Text) + Double.Parse(Me.txttI.Text) + _
                    Double.Parse(Me.txttA0.Text) + Double.Parse(Me.txttAA.Text) + Double.Parse(Me.txttAB.Text) + _
                    Double.Parse(Me.txttAC.Text) + Double.Parse(Me.txttAD.Text) + Double.Parse(Me.txttAE.Text) + _
                    Double.Parse(Me.txttAF.Text) + Double.Parse(Me.txttAG.Text) + Double.Parse(Me.txttAH.Text) + _
                    Double.Parse(Me.txttAI.Text) + Double.Parse(Me.txttB0.Text) + Double.Parse(Me.txttBA.Text) + _
                    Double.Parse(Me.txttBB.Text) + Double.Parse(Me.txttBC.Text) + Double.Parse(Me.txttBD.Text) + _
                    Double.Parse(Me.txttBE.Text) + Double.Parse(Me.txttBF.Text) + Double.Parse(Me.txttBG.Text) + _
                    Double.Parse(Me.txttBH.Text) + Double.Parse(Me.txttBI.Text) + Double.Parse(Me.txttC0.Text) + _
                    Double.Parse(Me.txttCA.Text) + Double.Parse(Me.txttCB.Text) + Double.Parse(Me.txttCC.Text) + _
                    Double.Parse(Me.txttCD.Text) + Double.Parse(Me.txttCE.Text) + Double.Parse(Me.txttCF.Text) + _
                    Double.Parse(Me.txttCG.Text) + Double.Parse(Me.txttCH.Text) + Double.Parse(Me.txttCI.Text) + _
                    Double.Parse(Me.txttD0.Text) + Double.Parse(Me.txttDA.Text) + Double.Parse(Me.txttDB.Text) + _
                    Double.Parse(Me.txttDC.Text) + Double.Parse(Me.txttDD.Text) + Double.Parse(Me.txttDE.Text) + _
                    Double.Parse(Me.txttDF.Text) + Double.Parse(Me.txttDG.Text) + Double.Parse(Me.txttDH.Text) + _
                    Double.Parse(Me.txttDI.Text) + Double.Parse(Me.txttE0.Text)

                    Greetings - Jacek

                    1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      Have a look at this little beauty, courtesy of QA:

                      ptotal = Double.Parse(Me.txtt1.Text) + Double.Parse(Me.txtt2.Text) + Double.Parse(Me.txtt3.Text) + _
                      Double.Parse(Me.txtt4.Text) + Double.Parse(Me.txtt5.Text) + Double.Parse(Me.txtt6.Text) + _
                      Double.Parse(Me.txtt7.Text) + Double.Parse(Me.txtt8.Text) + Double.Parse(Me.txtt9.Text) + _
                      Double.Parse(Me.txtt10.Text) + Double.Parse(Me.txtt11.Text) + Double.Parse(Me.txtt12.Text) + _
                      Double.Parse(Me.txtt13.Text) + Double.Parse(Me.txtt14.Text) + Double.Parse(Me.txtt15.Text) + _
                      Double.Parse(Me.txtt16.Text) + Double.Parse(Me.txtt17.Text) + Double.Parse(Me.txtt18.Text) + _
                      Double.Parse(Me.txtt19.Text) + Double.Parse(Me.txtt20.Text) + Double.Parse(Me.txtt21.Text) + _
                      Double.Parse(Me.txtt22.Text) + Double.Parse(Me.txtt23.Text) + Double.Parse(Me.txtt24.Text) + _
                      Double.Parse(Me.txtt25.Text) + Double.Parse(Me.txtt26.Text) + Double.Parse(Me.txtt27.Text) + _
                      Double.Parse(Me.txtt28.Text) + Double.Parse(Me.txtt29.Text) + Double.Parse(Me.txtt30.Text) + _
                      Double.Parse(Me.txtt31.Text) + Double.Parse(Me.txtt32.Text) + Double.Parse(Me.txtt33.Text) + _
                      Double.Parse(Me.txtt34.Text) + Double.Parse(Me.txtt35.Text) + Double.Parse(Me.txtt36.Text) + _
                      Double.Parse(Me.txtt37.Text) + Double.Parse(Me.txtt38.Text) + Double.Parse(Me.txtt39.Text) + _
                      Double.Parse(Me.txtt40.Text) + Double.Parse(Me.txtt41.Text) + Double.Parse(Me.txtt42.Text) + _
                      Double.Parse(Me.txtt43.Text) + Double.Parse(Me.txtt44.Text) + Double.Parse(Me.txtt45.Text) + _
                      Double.Parse(Me.txtt46.Text) + Double.Parse(Me.txtt47.Text) + Double.Parse(Me.txtt48.Text) + _
                      Double.Parse(Me.txtt49.Text) + Double.Parse(Me.txtt50.Text)

                      O.M.G. What else can you do, but gaze upon it's plethora of hideous features...Yes, those are all TextBoxes. :doh:

                      The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                      K Offline
                      K Offline
                      Killzone DeathMan
                      wrote on last edited by
                      #26

                      What else can you do? Well lets seeeeee......

                      double ptotal = 0;

                      foreach(Control ctrl in this.controls)
                      {
                      if(ctrl is TextBox)
                      ptotal += Double.Parse(ctrl.Text);
                      }

                      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