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.
  • B BobJanova

    After that post in the Lounge earlier, there seems to be something of a trend of screwing up control structures today!

    G Offline
    G Offline
    Gary Wheeler
    wrote on last edited by
    #6

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

    Software Zen: delete this;

    K 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;

      D Offline
      D Offline
      dexterama
      wrote on last edited by
      #7

      Yeah... just last week it took me and another engineer brainstorming for an hour before we realized a bit was flipped the wrong way. Our world is fun, wild, and at times all too damned granular. :)

      Think of how stupid the average person is, and realize half of them are stupider than that. - George Carlin

      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;

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #8

        Oops! That had to hurt.

        I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking

        G 1 Reply Last reply
        0
        • B Brisingr Aerowing

          Oops! That had to hurt.

          I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #9

          Fortunately it's in some logging code that only field service cares about.

          Software Zen: delete this;

          B 1 Reply Last reply
          0
          • G Gary Wheeler

            Fortunately it's in some logging code that only field service cares about.

            Software Zen: delete this;

            B Offline
            B Offline
            Brisingr Aerowing
            wrote on last edited by
            #10

            Phew. If that had been anywhere else, you would have had a major problem there.

            I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking

            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;

              N Offline
              N Offline
              NormDroid
              wrote on last edited by
              #11

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

              Software Kinetics - Dependable Software news

              A A 2 Replies Last reply
              0
              • N NormDroid

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

                Software Kinetics - Dependable Software news

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

                Norm .net wrote:

                Don't you just love scoping braces

                You also dig chicks with braces?

                Thou mewling ill-breeding pignut!

                M 1 Reply Last reply
                0
                • A AspDotNetDev

                  Norm .net wrote:

                  Don't you just love scoping braces

                  You also dig chicks with braces?

                  Thou mewling ill-breeding pignut!

                  M Offline
                  M Offline
                  Manfred Rudolf Bihy
                  wrote on last edited by
                  #13

                  Nothing against them except perchance in, humm, let's say orally challenging situations. ;P

                  "I had the right to remain silent, but I didn't have the ability!"

                  Ron White, Comedian

                  E 1 Reply Last reply
                  0
                  • M Manfred Rudolf Bihy

                    Nothing against them except perchance in, humm, let's say orally challenging situations. ;P

                    "I had the right to remain silent, but I didn't have the ability!"

                    Ron White, Comedian

                    E Offline
                    E Offline
                    enhzflep
                    wrote on last edited by
                    #14

                    What a catch!

                    Make it work. Then do it better - Andrei Straut

                    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;

                      S Offline
                      S Offline
                      Shao Voon Wong
                      wrote on last edited by
                      #15

                      Add this comment before anyone notice your code!

                      // This embarrassing code is definitely not written by Gary Wheeler!
                      if (_Uptime != null)
                      {
                      _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
                      }
                      {
                      _Uptime = new Service.Message();
                      _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
                      }

                      :laugh:

                      B 1 Reply Last reply
                      0
                      • S Shao Voon Wong

                        Add this comment before anyone notice your code!

                        // This embarrassing code is definitely not written by Gary Wheeler!
                        if (_Uptime != null)
                        {
                        _Uptime.Remove(TraCommon.Tokens.TraService_Speed);
                        }
                        {
                        _Uptime = new Service.Message();
                        _Uptime.Code = SysCommon.CommandCode.SysUptimeEvt;
                        }

                        :laugh:

                        B Offline
                        B Offline
                        BobJanova
                        wrote on last edited by
                        #16

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

                        G 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;

                          V Offline
                          V Offline
                          V 0
                          wrote on last edited by
                          #17

                          Don't be too embarassed. It's quite normal[^]

                          V.
                          (MQOTD Rules and previous Solutions )

                          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 7894920
                            wrote on last edited by
                            #18

                            At the risk of starting a slashdot-style flame war I refuse to code an if without:

                            if (condition) {
                            consequence;
                            } else {
                            negative consequence;
                            }

                            Can't help it. Can't change it. 56 years old and too old to recover from it. But also pretty hard to miss an 'else'. Please don't hate me...

                            G 1 Reply Last reply
                            0
                            • U User 7894920

                              At the risk of starting a slashdot-style flame war I refuse to code an if without:

                              if (condition) {
                              consequence;
                              } else {
                              negative consequence;
                              }

                              Can't help it. Can't change it. 56 years old and too old to recover from it. But also pretty hard to miss an 'else'. Please don't hate me...

                              G Offline
                              G Offline
                              Gary Wheeler
                              wrote on last edited by
                              #19

                              Part of my problem is that, due to changes in style guidelines in my group over time, I have a body of older code that uses K&R braces. My newer stuff, including the aforementioned C#, uses the brace-per-line style.

                              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;

                                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
                                          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