26

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.

Comments
  • 3
    Integer overflow
  • 1
    When 01111111111111 go to 10000000000000
  • 4
    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
  • 2
    Where is my candy?
  • 5
    @stop I promise you, when sending candy will be a DevRant feature you'll have one!
  • 8
    @dfox Get on it! @stop needs his candy!
  • 1
    Can someone help me understand it?
  • 1
    In 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
  • 1
    @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
  • 2
    @VacGamer actually, a gifting feature would be kind of cool. Even if it was just gifting rep. #scopecreep
Add Comment