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

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. WishUnderflow

WishUnderflow

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
41 Posts 35 Posters 0 Views
  • 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 [email protected]

    Wouldn't it depend on the order of operations, you'd think even vibe coding a genie would still have the sense to lower the counter before granting the wish.

    So logically

    Wishes = 3

    Make wish count zero.

    *wish used, wish count 2

    Wish applied, wish count 0

    F This user is from outside of this forum
    F This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #28

    It seems logical to decrement after the wish is granted, imo. Just causes issues in this particular case...

    T 1 Reply Last reply
    5
    • B [email protected]

      If there's parallelism/async involved, then there definitely is an argument to decrement first, execute later. Otherwise you could make a wish for the genie to just wait for an hour and then make as many wishes as you want within that hour.

      gutek8134@lemmy.worldG This user is from outside of this forum
      gutek8134@lemmy.worldG This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #29

      What if one of the threads crashes while executing the wish? I demand warranty!

      1 Reply Last reply
      5
      • F [email protected]

        It seems logical to decrement after the wish is granted, imo. Just causes issues in this particular case...

        T This user is from outside of this forum
        T This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #30

        Dunno, I know enough duplicate exploits in games to know giving the effect then reducing the item, is a pretty common source of duplication hacks/bugs.

        I guess it comes down to which is the designer is more afraid of happening, the chance of a wish being expended but not granted, or granted without expending.

        Then again based on disney's aladin, tricking the genie into rescuing him without using a wish, it does seem practical to assume that the genie errors on the side of granting without expending.

        1 Reply Last reply
        4
        • M [email protected]

          Now make it 2.5 wishes. Now 0.9. Now 999.

          L This user is from outside of this forum
          L This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #31

          Genie API times out due to detected fuzzing

          1 Reply Last reply
          2
          • B [email protected]

            But how can you decrement a future dated wish, since you can't guarantee nothing will happen that prevents the genies ability from executing said wish? E.g. i mean like telling the Genie to do something 5 days from now, not your example which would begin immediately after making said wish.

            C This user is from outside of this forum
            C This user is from outside of this forum
            [email protected]
            wrote on last edited by [email protected]
            #32

            I always thought that wish-granting is instant, even if the effects of that wish are delayed.

            So if I wish for something to happen in 5 days, it's granted in the moment and guaranteed to happen. That raises a question though: Can I wish to cancel a wish I have already made, but whose effect has not yet taken hold? On its face, this should be possible, but if we take it as a given that all valid wishes are always granted at the moment of utterance, then it might be physically/psychologically impossible for me or anyone else to revoke the wish before its IRL effect is complete.

            1 Reply Last reply
            0
            • merari42@lemmy.worldM [email protected]
              This post did not contain any content.
              G This user is from outside of this forum
              G This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #33

              Righto Gandhi, put the nukes away

              1 Reply Last reply
              4
              • merari42@lemmy.worldM [email protected]
                This post did not contain any content.
                J This user is from outside of this forum
                J This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #34

                Id they were optimized to use unsignrd they would be optimized to use 2 bits for 3 wishes rather than 8. You have 3 wishes left.

                1 Reply Last reply
                3
                • E This user is from outside of this forum
                  E This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #35

                  Every wish you grant causes you to owe more wishes to the genie

                  1 Reply Last reply
                  0
                  • merari42@lemmy.worldM [email protected]
                    This post did not contain any content.
                    ethanol@pawb.socialE This user is from outside of this forum
                    ethanol@pawb.socialE This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #36

                    Not a computer scientist but (regarding the post title), this is still classified as an integer overflow as the result -1 flows out of the domain your datatype can represent (0-255).
                    An integer underflow is when two numbers are so close to each other they become indistinct in your representation. For example a number that is so small, a float would represent it as 0.
                    Love the meme though 🙂

                    1 Reply Last reply
                    6
                    • S [email protected]

                      I love being a nerd

                      E This user is from outside of this forum
                      E This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #37

                      i think both solutions are valid, since sometimes you pay before and sometimes after receiving the service

                      1 Reply Last reply
                      2
                      • merari42@lemmy.worldM [email protected]
                        This post did not contain any content.
                        quantenzitrone@lemmings.worldQ This user is from outside of this forum
                        quantenzitrone@lemmings.worldQ This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #38

                        I'd like yo have '); DROP TABLE Wishes wishes

                        1 Reply Last reply
                        2
                        • savvywolf@pawb.socialS [email protected]

                          I had a visceral reaction to this because obviously the wish count should be decremented before the wish takes place. Even though I can't think up a convincing technical argument for it.

                          T This user is from outside of this forum
                          T This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #39

                          You’d need a check to make sure they don’t wish for something not allowed (like more wishes).

                          1 Reply Last reply
                          0
                          • dumhuvud@programming.devD [email protected]

                            Yeah, but what if the counter gets decremented before the wish gets granted, huh?

                            mesa@programming.devM This user is from outside of this forum
                            mesa@programming.devM This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #40

                            Didn't even get the joke here because this is how I always imagined genie wishes working.

                            1 Reply Last reply
                            0
                            • dumhuvud@programming.devD [email protected]

                              Yeah, but what if the counter gets decremented before the wish gets granted, huh?

                              S This user is from outside of this forum
                              S This user is from outside of this forum
                              [email protected]
                              wrote on last edited by [email protected]
                              #41

                              You have 3 wishes.

                              First wish: I wish my last wish would count as me consuming two wishes.
                              Second wish: I wish to have 0 wishes remaining.

                              First wish puts you down one wish, so ending at 2.
                              Second wish removes one wish, so at one, then wish happens putting you at 0,

                              then because this second wish now becomes your last, as you have 0 remaining, the first wish then takes effect and consumes another wish, putting you to - 1 and overflowing.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups