Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Funny fact : we were using this int to determine the expiration date to the activation link sended to the users.
expiration.setTime(currentTime + ttl);
- Why the fuck the expiration date is in the past....
*** Few minutes debugging later ***
- Oh shit the ttl is negative
#noluck -
stop68678yIn Binary you havent negative numbers. They use the first bit to indicate negative numbers
Example(binary is with b prefixed and decimal with d):
b0111 = d7
b0111 + b1 = b1000
b1000 = d-0 -
Pointer32498y@stop Ah...no.
Actually, negative representation in binary it's managed by two complement of a number.
The 0 value is absolute, because it's two complement is still 0.
0 = 0000
TC of 0 = 1111 + 0001 = 0000 (carry one).
Thus, for example:
6 = 1010
-6 = 0101 + 0001 = 0110 -
@VacGamer actually, a gifting feature would be kind of cool. Even if it was just gifting rep. #scopecreep
Related Rants
Today users weren't able to sign up on our website in production.
The guilty code :
int ttl = 5256005760;
The first who find why will have a candy.
undefined
production