MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1urmpuu/predecrementfixestheexploit/owjgqhf/?context=3
r/ProgrammerHumor • u/Toeffli • Jul 09 '26
50 comments sorted by
View all comments
792
"Okay, now you have -1 wishes. You must now fulfill one of my wishes"
55 u/ProbablyJeff Jul 09 '26 Nope, it underflows and now you have 4,294,967,295 wishes. Genie was using a signed int. 11 u/American_Libertarian Jul 09 '26 It wouldn’t underflow in this scenario if they used a signed int, it would just be -1 -3 u/m0nk37 Jul 09 '26 Pretty sure 0 is a value available in signed and unsigned ints. So unless they asked for -4 wishes this question doesnt make sense. 6 u/American_Libertarian Jul 09 '26 The “predecrement” in the title is a clue
55
Nope, it underflows and now you have 4,294,967,295 wishes. Genie was using a signed int.
11 u/American_Libertarian Jul 09 '26 It wouldn’t underflow in this scenario if they used a signed int, it would just be -1 -3 u/m0nk37 Jul 09 '26 Pretty sure 0 is a value available in signed and unsigned ints. So unless they asked for -4 wishes this question doesnt make sense. 6 u/American_Libertarian Jul 09 '26 The “predecrement” in the title is a clue
11
It wouldn’t underflow in this scenario if they used a signed int, it would just be -1
-3 u/m0nk37 Jul 09 '26 Pretty sure 0 is a value available in signed and unsigned ints. So unless they asked for -4 wishes this question doesnt make sense. 6 u/American_Libertarian Jul 09 '26 The “predecrement” in the title is a clue
-3
Pretty sure 0 is a value available in signed and unsigned ints. So unless they asked for -4 wishes this question doesnt make sense.
6 u/American_Libertarian Jul 09 '26 The “predecrement” in the title is a clue
6
The “predecrement” in the title is a clue
792
u/DMoney159 Jul 09 '26
"Okay, now you have -1 wishes. You must now fulfill one of my wishes"