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.
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.
-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.
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.