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. I didn't believe it

I didn't believe it

Scheduled Pinned Locked Moved The Lounge
question
12 Posts 9 Posters 2 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.
  • J jschell

    Came across this bit of code in a review

    int v = 2 >> 10;

    Usually I just skim by stuff like this because I figure the programmer knows what they are doing. Then I went back and looked because it was specify a max size so I figured someone was being clever. And 'clever' doesn't mean good code. Then I realized it definitely was not clever. Always willing to question myself I started wondering if I was misreading it. Or if I had actually forgotten what the operator did. So I wrote code just to verify it. If it hadn't been so weird and so wrong I wouldn't have spent that much time on it.

    B Offline
    B Offline
    BernardIE5317
    wrote on last edited by
    #3

    Was the author made aware of the error. Perhaps the authors' finger missed the '<' key.

    J 1 Reply Last reply
    0
    • B BernardIE5317

      Was the author made aware of the error. Perhaps the authors' finger missed the '<' key.

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

      I agree.

      "A little time, a little trouble, your better day" Badfinger

      1 Reply Last reply
      0
      • J jschell

        Came across this bit of code in a review

        int v = 2 >> 10;

        Usually I just skim by stuff like this because I figure the programmer knows what they are doing. Then I went back and looked because it was specify a max size so I figured someone was being clever. And 'clever' doesn't mean good code. Then I realized it definitely was not clever. Always willing to question myself I started wondering if I was misreading it. Or if I had actually forgotten what the operator did. So I wrote code just to verify it. If it hadn't been so weird and so wrong I wouldn't have spent that much time on it.

        C Offline
        C Offline
        charlieg
        wrote on last edited by
        #5

        maybe just v = 0x.....? all cute code needs to be bitch slapped out of noobs

        Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

        1 Reply Last reply
        0
        • J jschell

          Came across this bit of code in a review

          int v = 2 >> 10;

          Usually I just skim by stuff like this because I figure the programmer knows what they are doing. Then I went back and looked because it was specify a max size so I figured someone was being clever. And 'clever' doesn't mean good code. Then I realized it definitely was not clever. Always willing to question myself I started wondering if I was misreading it. Or if I had actually forgotten what the operator did. So I wrote code just to verify it. If it hadn't been so weird and so wrong I wouldn't have spent that much time on it.

          T Offline
          T Offline
          trønderen
          wrote on last edited by
          #6

          It would be a great way to detect if anyone stole their code. The OP only says that he came across it 'in a review', so the code may not be open source. Even if open source, it may have been inserted to detect if anyone uses the code without giving the required credit to the source. Or maybe it was the developer's little test to see how observant the reviewers are :-) Map companies often add small, non-existing villages to their maps to detect theft. I guess similar things is common in other fields as well.

          Religious freedom is the freedom to say that two plus two make five.

          J Richard DeemingR 2 Replies Last reply
          0
          • T trønderen

            It would be a great way to detect if anyone stole their code. The OP only says that he came across it 'in a review', so the code may not be open source. Even if open source, it may have been inserted to detect if anyone uses the code without giving the required credit to the source. Or maybe it was the developer's little test to see how observant the reviewers are :-) Map companies often add small, non-existing villages to their maps to detect theft. I guess similar things is common in other fields as well.

            Religious freedom is the freedom to say that two plus two make five.

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #7

            That is an interesting idea. Original author could have copied it from some other source.

            J 1 Reply Last reply
            0
            • Mircea NeacsuM Mircea Neacsu

              Maybe the author is just suffering of left-right confusion :laugh: Poor soul just wanted to write 2k.

              Mircea

              enhzflepE Offline
              enhzflepE Offline
              enhzflep
              wrote on last edited by
              #8

              Both my Mum and my partner exhibit LRD quite commonly. I can't think of any men I've known who commonly confuse the two. For a long time, I'd jokingly say, "Oh.. you mean boys right?". I've long since learned to hold up a hand and point left or right when confirming directions in the car. That invariably works just fine. I've just read a few excerpts from research papers on the subject which suggest there to be a greater number of women afflicted than men. Fewer however, than has been suggested by historical studies - studies which often asked questions which relied upon mental rotation of an image to discern if it was a left or right hand being presented. Men typically perform more accurately at rotation tasks. When studies have been run which remove this task from tests, the difference is smaller but still present. On a side-note, I've just learned that about 65% of orangutangs are left-handed.

              Mircea NeacsuM 1 Reply Last reply
              0
              • enhzflepE enhzflep

                Both my Mum and my partner exhibit LRD quite commonly. I can't think of any men I've known who commonly confuse the two. For a long time, I'd jokingly say, "Oh.. you mean boys right?". I've long since learned to hold up a hand and point left or right when confirming directions in the car. That invariably works just fine. I've just read a few excerpts from research papers on the subject which suggest there to be a greater number of women afflicted than men. Fewer however, than has been suggested by historical studies - studies which often asked questions which relied upon mental rotation of an image to discern if it was a left or right hand being presented. Men typically perform more accurately at rotation tasks. When studies have been run which remove this task from tests, the difference is smaller but still present. On a side-note, I've just learned that about 65% of orangutangs are left-handed.

                Mircea NeacsuM Offline
                Mircea NeacsuM Offline
                Mircea Neacsu
                wrote on last edited by
                #9

                My mom also had this affliction. And also car trips where my father was driving and my mom was following the map and giving directions were hilarious: "turn left; no, the other left!".

                enhzflep wrote:

                Men typically perform more accurately at rotation tasks.

                The better spatial orientation skills in men might be related to their historical role as hunters. Men who couldn't keep a good mental map of the environment were less able to bring home dinner and had a better chance of becoming lunch :)

                Mircea

                enhzflepE 1 Reply Last reply
                0
                • Mircea NeacsuM Mircea Neacsu

                  My mom also had this affliction. And also car trips where my father was driving and my mom was following the map and giving directions were hilarious: "turn left; no, the other left!".

                  enhzflep wrote:

                  Men typically perform more accurately at rotation tasks.

                  The better spatial orientation skills in men might be related to their historical role as hunters. Men who couldn't keep a good mental map of the environment were less able to bring home dinner and had a better chance of becoming lunch :)

                  Mircea

                  enhzflepE Offline
                  enhzflepE Offline
                  enhzflep
                  wrote on last edited by
                  #10

                  Ahhh, of course. Thanks for speculating. :thumbsup: I couldn't for the life of me come up with a theory as to why gender would play such a role. But when you put it that way, it seems perfectly reasonable that men simply had those less adept at the skill culled from their ranks, leaving only the proficient ones left to create offspring.

                  1 Reply Last reply
                  0
                  • J jschell

                    That is an interesting idea. Original author could have copied it from some other source.

                    J Offline
                    J Offline
                    jochance
                    wrote on last edited by
                    #11

                    Seems right except the >> instead of <<... I would do something like that if I were trying to exhibit better the "magic number"... this size is the max length in bytes of the 10-bit field.

                    1 Reply Last reply
                    0
                    • T trønderen

                      It would be a great way to detect if anyone stole their code. The OP only says that he came across it 'in a review', so the code may not be open source. Even if open source, it may have been inserted to detect if anyone uses the code without giving the required credit to the source. Or maybe it was the developer's little test to see how observant the reviewers are :-) Map companies often add small, non-existing villages to their maps to detect theft. I guess similar things is common in other fields as well.

                      Religious freedom is the freedom to say that two plus two make five.

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #12

                      A bit like the teachers now adding "invisible" text (white-on-white) to their homework assignments to catch the students who copy-n-paste into ChatGPT to cheat on their homework. :D


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      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