C usual arithmetic conversions

Indeed b is converted to unsigned. However what you observed is that b converted to unsigned and then added to 10 gives as value 5.

On x86 32bit this is what happens

  1. b, coverted to unsigned, becomes 4294967291 (i.e. 2**32 - 5)
  2. adding 10 becomes 5 because of wrap-around at 2**32 (2**32 - 5 + 10 = 2**32 + 5 = 5)

Leave a Comment