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. It's too complicated to understand

It's too complicated to understand

Scheduled Pinned Locked Moved The Weird and The Wonderful
pythoncomperformancelearning
12 Posts 12 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.
  • M Marc Clifton

    //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
    //I know this will work

    Followed by some counter increments. :doh: Marc

    V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    J Offline
    J Offline
    jeron1
    wrote on last edited by
    #3

    Kind of reminds me of one one Jeff Spicoli, on fixing a car.

    Quote:

    Relax, all right? My old man is a television repairman, he's got this ultimate set of tools. I can fix it.

    "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

    1 Reply Last reply
    0
    • M Marc Clifton

      //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
      //I know this will work

      Followed by some counter increments. :doh: Marc

      V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      raddevusR Offline
      raddevusR Offline
      raddevus
      wrote on last edited by
      #4

      comment said:

      //I know this will work

      // Note to self: do not make notes to self in comments in code.

      :laugh:

      L K 2 Replies Last reply
      0
      • M Marc Clifton

        //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
        //I know this will work

        Followed by some counter increments. :doh: Marc

        V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #5

        //You are not expected to understand this.

        :-D

        1 Reply Last reply
        0
        • M Marc Clifton

          //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
          //I know this will work

          Followed by some counter increments. :doh: Marc

          V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          N Offline
          N Offline
          Nathan Minier
          wrote on last edited by
          #6

          That reads like a Daily Affirmation with Stuart Smalley. Brilliant!

          "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

          1 Reply Last reply
          0
          • M Marc Clifton

            //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
            //I know this will work

            Followed by some counter increments. :doh: Marc

            V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            V Offline
            V Offline
            virang_21
            wrote on last edited by
            #7
                                    #region Note To Future Developer
                                    /\* NOTE TO FUTURE DEVELOPER \*/
            
                                    /\* You might look at below line of code and wonder why this is done this way. You are already
                                     checking for order type in download process. Business has done politician level backflip  on the last day of UAT 
                                     on the original logic and wanted to check if they have created 2 COs with same job number and first is already processed
                                     next one needs to be regen. Download would have it as a new code. 
                                     If this requirement was known from the beginning this logic would have been totally different.
                                     This logic makes download process pretty redundant as you may have called APIs when CO is scanned and get data from M3
                                     and do rest of the checking. \*/
            
            
            
                                    #endregion
            

            Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

            1 Reply Last reply
            0
            • M Marc Clifton

              //This is a bad way to merge in the dropdown info in terms of performance in the skins, but this code is too complicated to understand.
              //I know this will work

              Followed by some counter increments. :doh: Marc

              V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              M Offline
              M Offline
              MarkTJohnson
              wrote on last edited by
              #8

              At my first job we had a senior developer who was very into OOP. Only problem is the code base was Microsoft C 5.1. The guy was building C code like it was C++ classes, few people could follow it. After he moved on to bigger and better things I got to debug some of his stuff and found a comment like "We aren't supposed to free() the same pointer twice but since it doesn't hurt anything" Coming from Mister High and Mighty "Your code better conform and produce no warnings." :wtf:

              J 1 Reply Last reply
              0
              • M MarkTJohnson

                At my first job we had a senior developer who was very into OOP. Only problem is the code base was Microsoft C 5.1. The guy was building C code like it was C++ classes, few people could follow it. After he moved on to bigger and better things I got to debug some of his stuff and found a comment like "We aren't supposed to free() the same pointer twice but since it doesn't hurt anything" Coming from Mister High and Mighty "Your code better conform and produce no warnings." :wtf:

                J Offline
                J Offline
                Jon McKee
                wrote on last edited by
                #9

                MarkTJohnson wrote:

                We aren't supposed to free() the same pointer twice but since it doesn't hurt anything

                Oh my, that is a very dangerous assumption I've seen people make before.

                //First
                char* data = (char*)malloc(100 * sizeof *data);
                free(data);
                data = NULL;
                free(data);

                //Second
                char* data = (char*)malloc(100 * sizeof *data);
                free(data);
                free(data);

                First one isn't going to cause problems. Calling free on an allocated pointer de-allocates that memory. Calling free on a null pointer doesn't do anything. But calling free on a non-null, de-allocated pointer as in the second example de-allocates the memory again which has undefined behavior. Another process or thread could have allocated that memory before the 2nd de-allocation. Now you've invalidated memory another program was using.

                OriginalGriffO 1 Reply Last reply
                0
                • J Jon McKee

                  MarkTJohnson wrote:

                  We aren't supposed to free() the same pointer twice but since it doesn't hurt anything

                  Oh my, that is a very dangerous assumption I've seen people make before.

                  //First
                  char* data = (char*)malloc(100 * sizeof *data);
                  free(data);
                  data = NULL;
                  free(data);

                  //Second
                  char* data = (char*)malloc(100 * sizeof *data);
                  free(data);
                  free(data);

                  First one isn't going to cause problems. Calling free on an allocated pointer de-allocates that memory. Calling free on a null pointer doesn't do anything. But calling free on a non-null, de-allocated pointer as in the second example de-allocates the memory again which has undefined behavior. Another process or thread could have allocated that memory before the 2nd de-allocation. Now you've invalidated memory another program was using.

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

                  Or if you deallocate, allocate to something else, and then deallocate the original pointer again. Your new allocation has then been deallocated ... sometimes :~ Don't you just love intermittent bugs?

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  "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

                  1 Reply Last reply
                  0
                  • raddevusR raddevus

                    comment said:

                    //I know this will work

                    // Note to self: do not make notes to self in comments in code.

                    :laugh:

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #11

                    raddevus wrote:

                    // Note to self: do not make notes to self in comments in code.

                    Right. Use the third person instead.

                    The language is JavaScript. that of Mordor, which I will not utter here
                    This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                    "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

                    1 Reply Last reply
                    0
                    • raddevusR raddevus

                      comment said:

                      //I know this will work

                      // Note to self: do not make notes to self in comments in code.

                      :laugh:

                      K Offline
                      K Offline
                      KarstenK
                      wrote on last edited by
                      #12

                      I write often comment for my "future self" like "HACK", "TODO" :rolleyes:

                      Press F1 for help or google it. Greetings from Germany

                      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