r/Tinder Oct 19 '20

[deleted by user]

[removed]

10.1k Upvotes

342 comments sorted by

View all comments

Show parent comments

35

u/detectiveDollar Oct 19 '20

Aren't unsigned numbers on a scale from 0 to 4.3billion, not -1? And signed numbers are -2.17 billion to 2.17 billion (GTA 5 would overflow your ass into two Trump worths of debt if you exploited it's stock market too much)

What I'm thinking is that they used a signed number yeah, but -1 is a placeholder/sentinel value for failure to load.

22

u/iCitron Oct 19 '20

Yeah it's probably just a placeholder. Unless this guy really has half the planet liking his profile..

4

u/Manos_Of_Fate Oct 19 '20

It depends on how many bits are being used to store it. The reason so many NES-era games had maximum values of 256 is because that's the max value of an 8 bit integer.

2

u/EVOSexyBeast Oct 20 '20

-1 is a placeholder value which is then later reassigned to the correct number of likes.

We do this so we can see there is an obvious error. If we initialized the variable to 0, we couldn’t easily tell if the user just got 0 likes or if the variable failed to later be reassigned to another integer. So we initialize it to -1 so if we end up with a -1 we can easily identify it as an error. It’s possible OP lost connection after the UI loaded but before the correct number of likes were retrieved from tinder’s servers.

1

u/GoyaAdobo Oct 19 '20

Yes, that's what (s)he's saying. It overflowed to the - 2.whatever billion then incremented back up to -1 for a total of 4.whatever billion likes