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. it's the same code! isn't it?

it's the same code! isn't it?

Scheduled Pinned Locked Moved The Lounge
question
23 Posts 11 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 trønderen

    I was studying some code for an 8051, containing a test 'if (x > y)' and 2-3 statements to calculate a value, followed by an 'else' calculating the same value, but doing the partial expressions in a different order. I spent several hours trying to find the difference between the 'if' and 'else' clauses - mathematically they were identical. In math, 'sign extension' is a non-issue. In 8051 it is a real issue. y < x would lead to a sign extension in one partial expression that would lead to the wrong result in the 'if' clause. With x > y would see the same in another partial expression in the 'else' clause'. Obviously, there was not a single trace of any comment in the code. C code is 'self-documenting'. After seeing the light, I mentioned it to the guy who had programmed it. He just shrugged: 'That's how 8051 is!' Sort of saying 'if you want any comment to explain this, ask the 8051 to write it'.

    J Offline
    J Offline
    jmaida
    wrote on last edited by
    #12

    Good example of hardware architecture assumptions, pitfalls, etc. Know your hardware.

    1 Reply Last reply
    0
    • H honey the codewitch

      Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference? Yet it doesn't work. In this case, no sign of life. That has been my morning. Partial updates simply are not working on this display and I can't figure out for the life of me why. The only "decent" documentation for the display is the source code that it shipped with. This kind of thing is the absolute worst. Excepting the other things that are also the absolute worst.

      To err is human. Fortune favors the monsters.

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

      honey the codewitch wrote:

      Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference?

      Means there's a difference in environment, dear Watson.

      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

      H 1 Reply Last reply
      0
      • L Lost User

        honey the codewitch wrote:

        Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference?

        Means there's a difference in environment, dear Watson.

        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #14

        There's not, because the reference code works in the same precise environment. It means I'm missing something.

        To err is human. Fortune favors the monsters.

        L 1 Reply Last reply
        0
        • H honey the codewitch

          There's not, because the reference code works in the same precise environment. It means I'm missing something.

          To err is human. Fortune favors the monsters.

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

          You sure it's you? Not the environment? It can only be you if the code isn't doing the same.

          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          H 1 Reply Last reply
          0
          • L Lost User

            You sure it's you? Not the environment? It can only be you if the code isn't doing the same.

            Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #16

            It's remotely possible. For now I got frustrated with it, so I masked off the partial update feature and released version 0.9.0 without it. When I do figure it out it will slide in underneath without breaking changes.

            To err is human. Fortune favors the monsters.

            L 1 Reply Last reply
            0
            • H honey the codewitch

              It's remotely possible. For now I got frustrated with it, so I masked off the partial update feature and released version 0.9.0 without it. When I do figure it out it will slide in underneath without breaking changes.

              To err is human. Fortune favors the monsters.

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

              honey the codewitch wrote:

              It's remotely possible.

              Heh.

              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

              1 Reply Last reply
              0
              • H honey the codewitch

                Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference? Yet it doesn't work. In this case, no sign of life. That has been my morning. Partial updates simply are not working on this display and I can't figure out for the life of me why. The only "decent" documentation for the display is the source code that it shipped with. This kind of thing is the absolute worst. Excepting the other things that are also the absolute worst.

                To err is human. Fortune favors the monsters.

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #18

                In C#, my issue is often missing NuGet packages or different version of those packages. And sometimes stuff like ' vs. `, but those are usually pretty easy to spot (a non-printable character one time was not, though :sigh: ). Sometimes it's just easier to re-invent the wheel :laugh:

                Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                1 Reply Last reply
                0
                • H honey the codewitch

                  Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference? Yet it doesn't work. In this case, no sign of life. That has been my morning. Partial updates simply are not working on this display and I can't figure out for the life of me why. The only "decent" documentation for the display is the source code that it shipped with. This kind of thing is the absolute worst. Excepting the other things that are also the absolute worst.

                  To err is human. Fortune favors the monsters.

                  S Offline
                  S Offline
                  Slow Eddie
                  wrote on last edited by
                  #19

                  Been there, did that, hope never to go bach, Once spent 8 hours looking for a misplaced semi-colon. :(

                  ed

                  A 1 Reply Last reply
                  0
                  • S Slow Eddie

                    Been there, did that, hope never to go bach, Once spent 8 hours looking for a misplaced semi-colon. :(

                    ed

                    A Offline
                    A Offline
                    Andreas Mertens
                    wrote on last edited by
                    #20

                    Had a similar issue with a text string copied from somewhere (Word? Web page) and inserted into VS. Was failing horribly. After a lot of time spent on this, it turns out a non-printable character was in that string.... Once I manually re-typed the string, worked just fine....

                    E 1 Reply Last reply
                    0
                    • H honey the codewitch

                      Don't you hate when you're porting something, and you stare at the same section of non-working code over and over, comparing it to the reference source, and not seeing any meaningful difference? Yet it doesn't work. In this case, no sign of life. That has been my morning. Partial updates simply are not working on this display and I can't figure out for the life of me why. The only "decent" documentation for the display is the source code that it shipped with. This kind of thing is the absolute worst. Excepting the other things that are also the absolute worst.

                      To err is human. Fortune favors the monsters.

                      M Offline
                      M Offline
                      Mark Miller
                      wrote on last edited by
                      #21

                      Get up and go for a walk. Give your subconscious a chance to work on it. I've often had the answer during or shortly after a walk that I couldn't "see" before. Cheers!

                      Sincerely, -Mark mamiller@mhemail.org

                      H 1 Reply Last reply
                      0
                      • M Mark Miller

                        Get up and go for a walk. Give your subconscious a chance to work on it. I've often had the answer during or shortly after a walk that I couldn't "see" before. Cheers!

                        Sincerely, -Mark mamiller@mhemail.org

                        H Offline
                        H Offline
                        honey the codewitch
                        wrote on last edited by
                        #22

                        Yeah, I switched gears. I'll pick it up again later. I've already got some ideas on how to either narrow the problem, or uncover a larger issue. That's a start.

                        To err is human. Fortune favors the monsters.

                        1 Reply Last reply
                        0
                        • A Andreas Mertens

                          Had a similar issue with a text string copied from somewhere (Word? Web page) and inserted into VS. Was failing horribly. After a lot of time spent on this, it turns out a non-printable character was in that string.... Once I manually re-typed the string, worked just fine....

                          E Offline
                          E Offline
                          englebart
                          wrote on last edited by
                          #23

                          Be careful with sharing text with braces on MSTeams chat. Sometimes it inserts a “zero width space”. This also seems to be a trick that hackers use to fake URLs!

                          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