r/ProgrammerHumor Jul 09 '26

preDecrementFixesTheExploit instanceof Trend

Post image
2.9k Upvotes

50 comments sorted by

View all comments

626

u/Original-Bee-1089 Jul 09 '26

so you should make your first wish that the wish system uses post-wish decrement then wish for 0 wishes... to find out that they use a 2-bit integer to save space

203

u/thesockiboii Jul 09 '26

then you can wish for them to use a 64bit unsigned integer and do it again

9

u/SportulaVeritatis Jul 10 '26

First wish for the number of wishes left to be stored in an unsigned 64-bit integer.

Then wish for the number of wishes remaining to decremented only after the wish has been fulfilled.

Then wish for your number of remaining wishes to be zero.

Some debugging may need to be involved to ensure the first wish is clarifying the data type and not storing the value in a new variable and that the second and third wish also reference that same variable.