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. Now this is embarassing

Now this is embarassing

Scheduled Pinned Locked Moved The Weird and The Wonderful
45 Posts 26 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.
  • G Gary Wheeler

    if (_Uptime != null)
    {
    _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
    }
    {
    _Uptime = new Service.Message();
    _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
    }

    I just found this in my code. It's been there for years.

    Software Zen: delete this;

    F Offline
    F Offline
    Fabio Franco
    wrote on last edited by
    #20

    Gary Wheeler wrote:

    It's been there for years.

    Then it has been working for years too! Don't fix it!

    To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

    G 1 Reply Last reply
    0
    • G Gary Wheeler

      This[^] one? 'Tis quite similar. Mine was a sin of omission, while his was a sin of emission.

      Software Zen: delete this;

      K Offline
      K Offline
      KP Lee
      wrote on last edited by
      #21

      Gary Wheeler wrote:

      Mine was a sin of omission, while his was a sin of emission.

      Someone mentioned in the other link that an empty statement shouldn't be allowed after an if statement. I think both should be allowed, but have warning messages. His would be "The conditional statement won't execute anything", yours "Extra brackets added for no apparent reason". Both may be a stretch for the compiler to see. On the other hand, people who like padded coding might not like that.

      1 Reply Last reply
      0
      • G Gary Wheeler

        This[^] one? 'Tis quite similar. Mine was a sin of omission, while his was a sin of emission.

        Software Zen: delete this;

        K Offline
        K Offline
        KP Lee
        wrote on last edited by
        #22

        Thought I said "The conditional (if-else) statement won't execute anything" but I used the special characters (@lt; @or; >) that hid it and didn't look at my preview. Great, only gt works as substitution letters.

        1 Reply Last reply
        0
        • G Gary Wheeler

          if (_Uptime != null)
          {
          _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
          }
          {
          _Uptime = new Service.Message();
          _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
          }

          I just found this in my code. It's been there for years.

          Software Zen: delete this;

          U Offline
          U Offline
          User 3138470
          wrote on last edited by
          #23

          This reminds me why i hate ppl who write code like if (x != y) doThis(); remember one time when somebody added some code --> if (x != y) doThis(); alsoDoThat(); Took a while in debugger to figure out what was reason :-p Cause not part of my code :-) I always write my code after that if (x != y) { doThis(); } Even if have to do only one thing :-p

          G 1 Reply Last reply
          0
          • N NormDroid

            missing else? Don't you just love scoping braces.

            Software Kinetics - Dependable Software news

            A Offline
            A Offline
            Adriaan Davel
            wrote on last edited by
            #24

            I did this once in c++, took very long to figure out:

            if (condition);
            {

            }

            ____________________________________________________________ Be brave little warrior, be VERY brave

            G F 2 Replies Last reply
            0
            • G Gary Wheeler

              if (_Uptime != null)
              {
              _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
              }
              {
              _Uptime = new Service.Message();
              _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
              }

              I just found this in my code. It's been there for years.

              Software Zen: delete this;

              M Offline
              M Offline
              Michael Kingsford Gray
              wrote on last edited by
              #25

              Would have been obvious in VB.NET.

              A G 2 Replies Last reply
              0
              • M Michael Kingsford Gray

                Would have been obvious in VB.NET.

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #26

                Every line of code in VB.Net is obviously a mistake. ;P

                Thou mewling ill-breeding pignut!

                1 Reply Last reply
                0
                • A Adriaan Davel

                  I did this once in c++, took very long to figure out:

                  if (condition);
                  {

                  }

                  ____________________________________________________________ Be brave little warrior, be VERY brave

                  G Offline
                  G Offline
                  greldak
                  wrote on last edited by
                  #27

                  I'd be more concerned if there was something between the braces to get unexpectedly executed irrespective of the intended condition.

                  A 1 Reply Last reply
                  0
                  • G greldak

                    I'd be more concerned if there was something between the braces to get unexpectedly executed irrespective of the intended condition.

                    A Offline
                    A Offline
                    Adriaan Davel
                    wrote on last edited by
                    #28

                    That's exactly what happened, irrespective of the condition the code block always executed...

                    ____________________________________________________________ Be brave little warrior, be VERY brave

                    1 Reply Last reply
                    0
                    • A Adriaan Davel

                      I did this once in c++, took very long to figure out:

                      if (condition);
                      {

                      }

                      ____________________________________________________________ Be brave little warrior, be VERY brave

                      F Offline
                      F Offline
                      Frans_55129
                      wrote on last edited by
                      #29

                      And I did this once in C, also took me long to figure it out: for (i=0; i <= ....; i ++); { }

                      1 Reply Last reply
                      0
                      • B BobJanova

                        Sadly, SVN will tell you that it really is ;(

                        G Offline
                        G Offline
                        Gary R Wheeler
                        wrote on last edited by
                        #30

                        Embarassing2A: We use SourceSafe. Embarassing2B: It would still tell you that it really is.

                        Software Zen: delete this;

                        D 1 Reply Last reply
                        0
                        • U User 3138470

                          This reminds me why i hate ppl who write code like if (x != y) doThis(); remember one time when somebody added some code --> if (x != y) doThis(); alsoDoThat(); Took a while in debugger to figure out what was reason :-p Cause not part of my code :-) I always write my code after that if (x != y) { doThis(); } Even if have to do only one thing :-p

                          G Offline
                          G Offline
                          Gary R Wheeler
                          wrote on last edited by
                          #31

                          That's usually the case for me as well.

                          Software Zen: delete this;

                          1 Reply Last reply
                          0
                          • F Fabio Franco

                            Gary Wheeler wrote:

                            It's been there for years.

                            Then it has been working for years too! Don't fix it!

                            To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                            G Offline
                            G Offline
                            Gary R Wheeler
                            wrote on last edited by
                            #32

                            Actually, it's not. In the code you don't see, it ends up replacing existing information when it should be adding it. The existing information gets lost.

                            Software Zen: delete this;

                            F 1 Reply Last reply
                            0
                            • G Gary R Wheeler

                              Actually, it's not. In the code you don't see, it ends up replacing existing information when it should be adding it. The existing information gets lost.

                              Software Zen: delete this;

                              F Offline
                              F Offline
                              Fabio Franco
                              wrote on last edited by
                              #33

                              I did notice that. What I meant is that the application was obviously working for years with that code, unless it's been abandoned. If it was behaving incorrectly it would've been noticed before. I'm not saying that what the code was doing was correct, just that the application was behaving as expected.

                              To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                              G 1 Reply Last reply
                              0
                              • F Fabio Franco

                                I did notice that. What I meant is that the application was obviously working for years with that code, unless it's been abandoned. If it was behaving incorrectly it would've been noticed before. I'm not saying that what the code was doing was correct, just that the application was behaving as expected.

                                To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                G Offline
                                G Offline
                                Gary R Wheeler
                                wrote on last edited by
                                #34

                                This is in a portion of the application that logs performance information for our field service organization. The bug caused part of the information to be recorded less often than it was available. The only way it would be noticed is if the folks doing the 'data mining' were paying really close attention, and they're not. Unfortunately.

                                Software Zen: delete this;

                                1 Reply Last reply
                                0
                                • M Michael Kingsford Gray

                                  Would have been obvious in VB.NET.

                                  G Offline
                                  G Offline
                                  Gary R Wheeler
                                  wrote on last edited by
                                  #35

                                  Sorry, but I'm more of a 'braces'[^] kind of guy.

                                  Software Zen: delete this;

                                  1 Reply Last reply
                                  0
                                  • G Gary Wheeler

                                    if (_Uptime != null)
                                    {
                                    _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
                                    }
                                    {
                                    _Uptime = new Service.Message();
                                    _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
                                    }

                                    I just found this in my code. It's been there for years.

                                    Software Zen: delete this;

                                    L Offline
                                    L Offline
                                    lucien64
                                    wrote on last edited by
                                    #36

                                    :laugh: It took me a while... and even that I haven't written a line of code in years, I found the mistake. This is the reason why I started coding "if" constructs (and the like) with empty bodies even when they where short.

                                    if()
                                    {
                                    }
                                    else
                                    {
                                    }

                                    Only after that I filled in what had to be filled in.

                                    1 Reply Last reply
                                    0
                                    • G Gary Wheeler

                                      if (_Uptime != null)
                                      {
                                      _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
                                      }
                                      {
                                      _Uptime = new Service.Message();
                                      _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
                                      }

                                      I just found this in my code. It's been there for years.

                                      Software Zen: delete this;

                                      A Offline
                                      A Offline
                                      Abhinav S
                                      wrote on last edited by
                                      #37

                                      That is cool. What else have you been upto these past years?

                                      WP7.5 Apps - XKCD | Calvin | SMBC | Sound Meter | Speed Dial

                                      G 1 Reply Last reply
                                      0
                                      • G Gary R Wheeler

                                        Embarassing2A: We use SourceSafe. Embarassing2B: It would still tell you that it really is.

                                        Software Zen: delete this;

                                        D Offline
                                        D Offline
                                        Dan Neely
                                        wrote on last edited by
                                        #38

                                        You could always lie and say the blame was falsely attributed due to corruption.

                                        Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                        G 1 Reply Last reply
                                        0
                                        • D Dan Neely

                                          You could always lie and say the blame was falsely attributed due to corruption.

                                          Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                          G Offline
                                          G Offline
                                          Gary R Wheeler
                                          wrote on last edited by
                                          #39

                                          Embarassing3: I'm the SourceSafe *cough* data base *cough* admin, which means I'm responsible for ensuring the integrity of our source control system. Besides, this is far from the worst bug I've ever fixed that had been around for a while.

                                          Software Zen: delete this;

                                          D 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