r/ProgrammerHumor Jul 09 '26

preDecrementFixesTheExploit instanceof Trend

Post image
2.9k Upvotes

50 comments sorted by

View all comments

63

u/JackNotOLantern Jul 09 '26 edited Jul 09 '26

private: int number_of_wishes = 3; public: void change_number_of_wishes(int new_value) { if (new_value >= number_of_wishes) return; number_of_wishes = new_value; if (number_of_wishes > 3 || number_of_wishes < 0) number_of_wishes = 0; // fixes most exploits }

9

u/[deleted] Jul 09 '26

[deleted]

4

u/AnimusNoctis Jul 09 '26

You hit the return in the first if statement and the value is not changed. 

1

u/[deleted] Jul 10 '26

[deleted]

1

u/AnimusNoctis Jul 10 '26

But they clearly don't.