Hacker News new | past | comments | ask | show | jobs | submit login

Yes, in this specific example you still need the same number of operations. My point was, when you just use signed integers, it's easier to conceptualize and harder to screw up. It's more flexible for unforeseen future use cases. Also, this is a very simplified example case; in most scenarios those unforeseen possibilities will be more significant.

Given that switching to unsigned saves you exactly one bit, it's just not usually worth it. How often do you need exactly 32 bits of unsigned space, when 31 isn't enough, and you can't use 63? (I'm talking about standard-length integers here, not extreme situations where you're trying to make maximum use of 8 bits of storage or similar.)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: