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. The Lounge
  3. What a frustration!

What a frustration!

Scheduled Pinned Locked Moved The Lounge
15 Posts 10 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.
  • T Offline
    T Offline
    Tarek Elqusi
    wrote on last edited by
    #1

    I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

    N OriginalGriffO R L P 6 Replies Last reply
    0
    • T Tarek Elqusi

      I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      I've done worse, even commented what was supposed to happen, something like:

      void adjustBalance(boolean credit, long amount)
      {
      // if the amount is negative reverse the direction:
      if (amount > 0)
      {
      adjustBalance(!credit, -amount);
      }

      // proper transaction
      }

      speramus in juniperus

      M M 2 Replies Last reply
      0
      • T Tarek Elqusi

        I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

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

        I've done worse (as have most people) in C / C++:

        if (a = b)
        ...

        Or

        a == b * 3;

        You do feel a right fool when you finally spot it. Normally after a few hours of head scratching...and swearing, of course.

        The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

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

        R M 2 Replies Last reply
        0
        • N Nagy Vilmos

          I've done worse, even commented what was supposed to happen, something like:

          void adjustBalance(boolean credit, long amount)
          {
          // if the amount is negative reverse the direction:
          if (amount > 0)
          {
          adjustBalance(!credit, -amount);
          }

          // proper transaction
          }

          speramus in juniperus

          M Offline
          M Offline
          Mark_Wallace
          wrote on last edited by
          #4

          Don't give DD ideas.

          I wanna be a eunuchs developer! Pass me a bread knife!

          N 1 Reply Last reply
          0
          • T Tarek Elqusi

            I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

            R Offline
            R Offline
            Rage
            wrote on last edited by
            #5

            Tarek Elqusi wrote:

            <>

            This tells a lot about it... :rolleyes:

            ~RaGE();

            I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

            T 1 Reply Last reply
            0
            • T Tarek Elqusi

              I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

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

              Its normal it happens with best programmers, have a :java:

              1 Reply Last reply
              0
              • M Mark_Wallace

                Don't give DD ideas.

                I wanna be a eunuchs developer! Pass me a bread knife!

                N Offline
                N Offline
                Nagy Vilmos
                wrote on last edited by
                #7

                It was actually in a retail banking system. :-\

                speramus in juniperus

                1 Reply Last reply
                0
                • T Tarek Elqusi

                  I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

                  P Offline
                  P Offline
                  Paulo Augusto Kunzel
                  wrote on last edited by
                  #8

                  We've all done something like that.... But usually you swap > and < .... :-D

                  There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    I've done worse (as have most people) in C / C++:

                    if (a = b)
                    ...

                    Or

                    a == b * 3;

                    You do feel a right fool when you finally spot it. Normally after a few hours of head scratching...and swearing, of course.

                    The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

                    R Offline
                    R Offline
                    Rage
                    wrote on last edited by
                    #9

                    Both caught by warnings, I think. But, hell, who looks at warnings ? :rolleyes:

                    ~RaGE();

                    I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                    OriginalGriffO 1 Reply Last reply
                    0
                    • R Rage

                      Tarek Elqusi wrote:

                      <>

                      This tells a lot about it... :rolleyes:

                      ~RaGE();

                      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                      T Offline
                      T Offline
                      Tarek Elqusi
                      wrote on last edited by
                      #10

                      I coded this in VFP9

                      R 1 Reply Last reply
                      0
                      • T Tarek Elqusi

                        I coded this in VFP9

                        R Offline
                        R Offline
                        Rage
                        wrote on last edited by
                        #11

                        Really ? Cool. You must be the first person I came across with to use it. :cool:

                        ~RaGE();

                        I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                        1 Reply Last reply
                        0
                        • R Rage

                          Both caught by warnings, I think. But, hell, who looks at warnings ? :rolleyes:

                          ~RaGE();

                          I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

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

                          Depends on the compiler: they are both valid C, so some systems (particularly older ones) don;t even flag it up as a warning. :doh: And of course, I read what I meant to write... :laugh: With VS, my modified project templates turn "Treat warnings as errors" on to prevent me ignoring them! ;)

                          The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

                          "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
                          • N Nagy Vilmos

                            I've done worse, even commented what was supposed to happen, something like:

                            void adjustBalance(boolean credit, long amount)
                            {
                            // if the amount is negative reverse the direction:
                            if (amount > 0)
                            {
                            adjustBalance(!credit, -amount);
                            }

                            // proper transaction
                            }

                            speramus in juniperus

                            M Offline
                            M Offline
                            Marc Clifton
                            wrote on last edited by
                            #13

                            Nagy Vilmos wrote:

                            void adjustBalance(boolean credit, long amount)

                            Why, you must work for the US Govt! I think they have code like that for balancing the budget. :) Marc

                            Unit Testing Succinctly

                            1 Reply Last reply
                            0
                            • T Tarek Elqusi

                              I aimed in a program to check that if x = y I wrote it as : If x<>y I reviewed the code and ran the program, but it didn’t work. After several tries I went back to the code. I surprised how I wrote this when I intended the opposite.

                              K Offline
                              K Offline
                              Kschuler
                              wrote on last edited by
                              #14

                              I do that all the time. Which is why I always test code like that extensively.

                              1 Reply Last reply
                              0
                              • OriginalGriffO OriginalGriff

                                I've done worse (as have most people) in C / C++:

                                if (a = b)
                                ...

                                Or

                                a == b * 3;

                                You do feel a right fool when you finally spot it. Normally after a few hours of head scratching...and swearing, of course.

                                The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

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

                                That's at least one good thing about Delphi (and Pascal in general). := is assignment. = is equivalence. Lots of other things you can screw up but not the assignment vs equivalence error.

                                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