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. Quantity, not quality

Quantity, not quality

Scheduled Pinned Locked Moved The Weird and The Wonderful
debugging
15 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.
  • C ClementsDan

    I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

    void ProcessMessage()
    {
    if ( )
    {

    }

    if ( )
    {

    }

    if ( )
    {

    }

    if ( )
    {

    }

    while ( )
    {
    if ( )
    {
    continue;
    }

      if ( )
      {
         continue;
      }
    
      if ( )
      {
         continue;
      }
    
      if ( && )
      {
         if ( || )
         {
            if ( )
            {
    
            }
            else
            {
    
            }
    
            continue;
         }
      }
    
      if ( )
      {
         continue;
      }
    
    
      for ( ; ; )
      {
         if ( )
         {
    
         }
    
         if ( )
         {
            if ( )
            {
    
            }
    
            continue;
         }
    
         if ( )
         {
            if ( )
            {
    
            }
    
            continue;
         }
    
         if ( )
         {
            if ( )
            {
    
            }
            else
            {
    
            }
    
            if ( || || ( && ))
            {
               if ( )
               {
    
               }
            }
            else
            {
               if ( )
               {
    
               }
            }
    
            continue;
         }
    
         if ( )
         {
            for ( ; ; )
            {
               if ( )
               {
                  continue;
               }
    
               if ( )
               {
                  if ( )
                  {
    
                  }
                  else
                  {
    
                  }
    
                  if ( )
                  {
    
                  }
    
                  break;
               }
               else if ( )
               {
                  if ( || )
                  {
                     if ( )
                     {
                        if ( )
                        {
    
                        }
                     }
                  }
    
                  if ( )
                  {
    
                  }
                  else
                  {
    
                  }
    
                  continue;
               }
               else
               {
                  if ( )
                  {
    
                  }
    
                  break;
               }
    
    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #3

    (In Homers voice)[sobber][drool]Mmmm! Modular![/drool][/slobber]

    No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

    "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
    • C ClementsDan

      I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

      void ProcessMessage()
      {
      if ( )
      {

      }

      if ( )
      {

      }

      if ( )
      {

      }

      if ( )
      {

      }

      while ( )
      {
      if ( )
      {
      continue;
      }

        if ( )
        {
           continue;
        }
      
        if ( )
        {
           continue;
        }
      
        if ( && )
        {
           if ( || )
           {
              if ( )
              {
      
              }
              else
              {
      
              }
      
              continue;
           }
        }
      
        if ( )
        {
           continue;
        }
      
      
        for ( ; ; )
        {
           if ( )
           {
      
           }
      
           if ( )
           {
              if ( )
              {
      
              }
      
              continue;
           }
      
           if ( )
           {
              if ( )
              {
      
              }
      
              continue;
           }
      
           if ( )
           {
              if ( )
              {
      
              }
              else
              {
      
              }
      
              if ( || || ( && ))
              {
                 if ( )
                 {
      
                 }
              }
              else
              {
                 if ( )
                 {
      
                 }
              }
      
              continue;
           }
      
           if ( )
           {
              for ( ; ; )
              {
                 if ( )
                 {
                    continue;
                 }
      
                 if ( )
                 {
                    if ( )
                    {
      
                    }
                    else
                    {
      
                    }
      
                    if ( )
                    {
      
                    }
      
                    break;
                 }
                 else if ( )
                 {
                    if ( || )
                    {
                       if ( )
                       {
                          if ( )
                          {
      
                          }
                       }
                    }
      
                    if ( )
                    {
      
                    }
                    else
                    {
      
                    }
      
                    continue;
                 }
                 else
                 {
                    if ( )
                    {
      
                    }
      
                    break;
                 }
      
      C Offline
      C Offline
      CARPETBURNER
      wrote on last edited by
      #4

      Holy Cow Im suprised the debugger didnt have a stack overflow when it saw this!

      J 1 Reply Last reply
      0
      • C CARPETBURNER

        Holy Cow Im suprised the debugger didnt have a stack overflow when it saw this!

        J Offline
        J Offline
        Jeroen De Dauw
        wrote on last edited by
        #5

        I'm more surprised that the debugger didn't miraculously become intelligent and decided to commit sumicide :laugh:

        GSoC 2009 student for SMW! --- My little forums: http://code.bn2vs.com --- 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!

        1 Reply Last reply
        0
        • C ClementsDan

          I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

          void ProcessMessage()
          {
          if ( )
          {

          }

          if ( )
          {

          }

          if ( )
          {

          }

          if ( )
          {

          }

          while ( )
          {
          if ( )
          {
          continue;
          }

            if ( )
            {
               continue;
            }
          
            if ( )
            {
               continue;
            }
          
            if ( && )
            {
               if ( || )
               {
                  if ( )
                  {
          
                  }
                  else
                  {
          
                  }
          
                  continue;
               }
            }
          
            if ( )
            {
               continue;
            }
          
          
            for ( ; ; )
            {
               if ( )
               {
          
               }
          
               if ( )
               {
                  if ( )
                  {
          
                  }
          
                  continue;
               }
          
               if ( )
               {
                  if ( )
                  {
          
                  }
          
                  continue;
               }
          
               if ( )
               {
                  if ( )
                  {
          
                  }
                  else
                  {
          
                  }
          
                  if ( || || ( && ))
                  {
                     if ( )
                     {
          
                     }
                  }
                  else
                  {
                     if ( )
                     {
          
                     }
                  }
          
                  continue;
               }
          
               if ( )
               {
                  for ( ; ; )
                  {
                     if ( )
                     {
                        continue;
                     }
          
                     if ( )
                     {
                        if ( )
                        {
          
                        }
                        else
                        {
          
                        }
          
                        if ( )
                        {
          
                        }
          
                        break;
                     }
                     else if ( )
                     {
                        if ( || )
                        {
                           if ( )
                           {
                              if ( )
                              {
          
                              }
                           }
                        }
          
                        if ( )
                        {
          
                        }
                        else
                        {
          
                        }
          
                        continue;
                     }
                     else
                     {
                        if ( )
                        {
          
                        }
          
                        break;
                     }
          
          T Offline
          T Offline
          Tristan Rhodes
          wrote on last edited by
          #6

          That looks strangely familiar, did you delete 4 long case statements and about 10 foreach enumerator loops?

          ------------------------------- Carrier Bags - 21st Century Tumbleweed.

          1 Reply Last reply
          0
          • C ClementsDan

            I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

            void ProcessMessage()
            {
            if ( )
            {

            }

            if ( )
            {

            }

            if ( )
            {

            }

            if ( )
            {

            }

            while ( )
            {
            if ( )
            {
            continue;
            }

              if ( )
              {
                 continue;
              }
            
              if ( )
              {
                 continue;
              }
            
              if ( && )
              {
                 if ( || )
                 {
                    if ( )
                    {
            
                    }
                    else
                    {
            
                    }
            
                    continue;
                 }
              }
            
              if ( )
              {
                 continue;
              }
            
            
              for ( ; ; )
              {
                 if ( )
                 {
            
                 }
            
                 if ( )
                 {
                    if ( )
                    {
            
                    }
            
                    continue;
                 }
            
                 if ( )
                 {
                    if ( )
                    {
            
                    }
            
                    continue;
                 }
            
                 if ( )
                 {
                    if ( )
                    {
            
                    }
                    else
                    {
            
                    }
            
                    if ( || || ( && ))
                    {
                       if ( )
                       {
            
                       }
                    }
                    else
                    {
                       if ( )
                       {
            
                       }
                    }
            
                    continue;
                 }
            
                 if ( )
                 {
                    for ( ; ; )
                    {
                       if ( )
                       {
                          continue;
                       }
            
                       if ( )
                       {
                          if ( )
                          {
            
                          }
                          else
                          {
            
                          }
            
                          if ( )
                          {
            
                          }
            
                          break;
                       }
                       else if ( )
                       {
                          if ( || )
                          {
                             if ( )
                             {
                                if ( )
                                {
            
                                }
                             }
                          }
            
                          if ( )
                          {
            
                          }
                          else
                          {
            
                          }
            
                          continue;
                       }
                       else
                       {
                          if ( )
                          {
            
                          }
            
                          break;
                       }
            
            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #7

            OK, what did you replace it with?

            V J 2 Replies Last reply
            0
            • C ClementsDan

              I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

              void ProcessMessage()
              {
              if ( )
              {

              }

              if ( )
              {

              }

              if ( )
              {

              }

              if ( )
              {

              }

              while ( )
              {
              if ( )
              {
              continue;
              }

                if ( )
                {
                   continue;
                }
              
                if ( )
                {
                   continue;
                }
              
                if ( && )
                {
                   if ( || )
                   {
                      if ( )
                      {
              
                      }
                      else
                      {
              
                      }
              
                      continue;
                   }
                }
              
                if ( )
                {
                   continue;
                }
              
              
                for ( ; ; )
                {
                   if ( )
                   {
              
                   }
              
                   if ( )
                   {
                      if ( )
                      {
              
                      }
              
                      continue;
                   }
              
                   if ( )
                   {
                      if ( )
                      {
              
                      }
              
                      continue;
                   }
              
                   if ( )
                   {
                      if ( )
                      {
              
                      }
                      else
                      {
              
                      }
              
                      if ( || || ( && ))
                      {
                         if ( )
                         {
              
                         }
                      }
                      else
                      {
                         if ( )
                         {
              
                         }
                      }
              
                      continue;
                   }
              
                   if ( )
                   {
                      for ( ; ; )
                      {
                         if ( )
                         {
                            continue;
                         }
              
                         if ( )
                         {
                            if ( )
                            {
              
                            }
                            else
                            {
              
                            }
              
                            if ( )
                            {
              
                            }
              
                            break;
                         }
                         else if ( )
                         {
                            if ( || )
                            {
                               if ( )
                               {
                                  if ( )
                                  {
              
                                  }
                               }
                            }
              
                            if ( )
                            {
              
                            }
                            else
                            {
              
                            }
              
                            continue;
                         }
                         else
                         {
                            if ( )
                            {
              
                            }
              
                            break;
                         }
              
              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #8

              One quick guess. Was the project manager had a condition of payment on number of lines code?

              Vasudevan Deepak Kumar Personal Homepage
              Tech Gossips
              The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

              1 Reply Last reply
              0
              • P PIEBALDconsult

                OK, what did you replace it with?

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

                CTRL+A, DELETE. Then start it afresh. That would be a safer start than a buggy restart into the crazy maze.

                Vasudevan Deepak Kumar Personal Homepage
                Tech Gossips
                The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

                P 1 Reply Last reply
                0
                • V Vasudevan Deepak Kumar

                  CTRL+A, DELETE. Then start it afresh. That would be a safer start than a buggy restart into the crazy maze.

                  Vasudevan Deepak Kumar Personal Homepage
                  Tech Gossips
                  The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #10

                  Right, so what does it look like now?

                  1 Reply Last reply
                  0
                  • C ClementsDan

                    I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

                    void ProcessMessage()
                    {
                    if ( )
                    {

                    }

                    if ( )
                    {

                    }

                    if ( )
                    {

                    }

                    if ( )
                    {

                    }

                    while ( )
                    {
                    if ( )
                    {
                    continue;
                    }

                      if ( )
                      {
                         continue;
                      }
                    
                      if ( )
                      {
                         continue;
                      }
                    
                      if ( && )
                      {
                         if ( || )
                         {
                            if ( )
                            {
                    
                            }
                            else
                            {
                    
                            }
                    
                            continue;
                         }
                      }
                    
                      if ( )
                      {
                         continue;
                      }
                    
                    
                      for ( ; ; )
                      {
                         if ( )
                         {
                    
                         }
                    
                         if ( )
                         {
                            if ( )
                            {
                    
                            }
                    
                            continue;
                         }
                    
                         if ( )
                         {
                            if ( )
                            {
                    
                            }
                    
                            continue;
                         }
                    
                         if ( )
                         {
                            if ( )
                            {
                    
                            }
                            else
                            {
                    
                            }
                    
                            if ( || || ( && ))
                            {
                               if ( )
                               {
                    
                               }
                            }
                            else
                            {
                               if ( )
                               {
                    
                               }
                            }
                    
                            continue;
                         }
                    
                         if ( )
                         {
                            for ( ; ; )
                            {
                               if ( )
                               {
                                  continue;
                               }
                    
                               if ( )
                               {
                                  if ( )
                                  {
                    
                                  }
                                  else
                                  {
                    
                                  }
                    
                                  if ( )
                                  {
                    
                                  }
                    
                                  break;
                               }
                               else if ( )
                               {
                                  if ( || )
                                  {
                                     if ( )
                                     {
                                        if ( )
                                        {
                    
                                        }
                                     }
                                  }
                    
                                  if ( )
                                  {
                    
                                  }
                                  else
                                  {
                    
                                  }
                    
                                  continue;
                               }
                               else
                               {
                                  if ( )
                                  {
                    
                                  }
                    
                                  break;
                               }
                    
                    J Offline
                    J Offline
                    J4amieC
                    wrote on last edited by
                    #11

                    If you scroll that up and down real fast it looks kind of trippy.

                    1 Reply Last reply
                    0
                    • C ClementsDan

                      I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

                      void ProcessMessage()
                      {
                      if ( )
                      {

                      }

                      if ( )
                      {

                      }

                      if ( )
                      {

                      }

                      if ( )
                      {

                      }

                      while ( )
                      {
                      if ( )
                      {
                      continue;
                      }

                        if ( )
                        {
                           continue;
                        }
                      
                        if ( )
                        {
                           continue;
                        }
                      
                        if ( && )
                        {
                           if ( || )
                           {
                              if ( )
                              {
                      
                              }
                              else
                              {
                      
                              }
                      
                              continue;
                           }
                        }
                      
                        if ( )
                        {
                           continue;
                        }
                      
                      
                        for ( ; ; )
                        {
                           if ( )
                           {
                      
                           }
                      
                           if ( )
                           {
                              if ( )
                              {
                      
                              }
                      
                              continue;
                           }
                      
                           if ( )
                           {
                              if ( )
                              {
                      
                              }
                      
                              continue;
                           }
                      
                           if ( )
                           {
                              if ( )
                              {
                      
                              }
                              else
                              {
                      
                              }
                      
                              if ( || || ( && ))
                              {
                                 if ( )
                                 {
                      
                                 }
                              }
                              else
                              {
                                 if ( )
                                 {
                      
                                 }
                              }
                      
                              continue;
                           }
                      
                           if ( )
                           {
                              for ( ; ; )
                              {
                                 if ( )
                                 {
                                    continue;
                                 }
                      
                                 if ( )
                                 {
                                    if ( )
                                    {
                      
                                    }
                                    else
                                    {
                      
                                    }
                      
                                    if ( )
                                    {
                      
                                    }
                      
                                    break;
                                 }
                                 else if ( )
                                 {
                                    if ( || )
                                    {
                                       if ( )
                                       {
                                          if ( )
                                          {
                      
                                          }
                                       }
                                    }
                      
                                    if ( )
                                    {
                      
                                    }
                                    else
                                    {
                      
                                    }
                      
                                    continue;
                                 }
                                 else
                                 {
                                    if ( )
                                    {
                      
                                    }
                      
                                    break;
                                 }
                      
                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #12

                      That's called VP (Vertical Programming). :-D

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        OK, what did you replace it with?

                        J Offline
                        J Offline
                        Jorgen Sigvardsson
                        wrote on last edited by
                        #13

                        Probably nothing. I'm assuming he's doing maintenance code of something he didn't write (he wouldn't be posting here if he had!). Since it's maintenance, most people are reluctant to rewrite code. Especially if the code looks like this. God knows how the rest of the code looks like...

                        -- Kein Mitleid Für Die Mehrheit

                        C 1 Reply Last reply
                        0
                        • J Jorgen Sigvardsson

                          Probably nothing. I'm assuming he's doing maintenance code of something he didn't write (he wouldn't be posting here if he had!). Since it's maintenance, most people are reluctant to rewrite code. Especially if the code looks like this. God knows how the rest of the code looks like...

                          -- Kein Mitleid Für Die Mehrheit

                          C Offline
                          C Offline
                          ClementsDan
                          wrote on last edited by
                          #14

                          I did eventually decide to move the body of each loop into its own function. Still uglier than I'd like it to be, but yes, I was reluctant to rewrite it, especially when the problem I was trying to fix turned out to be somewhere else.

                          1 Reply Last reply
                          0
                          • C ClementsDan

                            I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.

                            void ProcessMessage()
                            {
                            if ( )
                            {

                            }

                            if ( )
                            {

                            }

                            if ( )
                            {

                            }

                            if ( )
                            {

                            }

                            while ( )
                            {
                            if ( )
                            {
                            continue;
                            }

                              if ( )
                              {
                                 continue;
                              }
                            
                              if ( )
                              {
                                 continue;
                              }
                            
                              if ( && )
                              {
                                 if ( || )
                                 {
                                    if ( )
                                    {
                            
                                    }
                                    else
                                    {
                            
                                    }
                            
                                    continue;
                                 }
                              }
                            
                              if ( )
                              {
                                 continue;
                              }
                            
                            
                              for ( ; ; )
                              {
                                 if ( )
                                 {
                            
                                 }
                            
                                 if ( )
                                 {
                                    if ( )
                                    {
                            
                                    }
                            
                                    continue;
                                 }
                            
                                 if ( )
                                 {
                                    if ( )
                                    {
                            
                                    }
                            
                                    continue;
                                 }
                            
                                 if ( )
                                 {
                                    if ( )
                                    {
                            
                                    }
                                    else
                                    {
                            
                                    }
                            
                                    if ( || || ( && ))
                                    {
                                       if ( )
                                       {
                            
                                       }
                                    }
                                    else
                                    {
                                       if ( )
                                       {
                            
                                       }
                                    }
                            
                                    continue;
                                 }
                            
                                 if ( )
                                 {
                                    for ( ; ; )
                                    {
                                       if ( )
                                       {
                                          continue;
                                       }
                            
                                       if ( )
                                       {
                                          if ( )
                                          {
                            
                                          }
                                          else
                                          {
                            
                                          }
                            
                                          if ( )
                                          {
                            
                                          }
                            
                                          break;
                                       }
                                       else if ( )
                                       {
                                          if ( || )
                                          {
                                             if ( )
                                             {
                                                if ( )
                                                {
                            
                                                }
                                             }
                                          }
                            
                                          if ( )
                                          {
                            
                                          }
                                          else
                                          {
                            
                                          }
                            
                                          continue;
                                       }
                                       else
                                       {
                                          if ( )
                                          {
                            
                                          }
                            
                                          break;
                                       }
                            
                            J Offline
                            J Offline
                            John R Shaw
                            wrote on last edited by
                            #15

                            Wow! That literally hurt my eyes. :wtf: Unfortunately I have seen similar code for text processing. You have to keep scrolling back up a hundred lines or so to find out where the value stored in that variable came from and just what the heck it is supposed to be; of course it was probably modified on the way down – loads of fun. :rolleyes:

                            INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

                            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