Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Signed integers have undefined overflow, but unsigned integers underflow really easily.

IMO unsigned integers shouldn't have a subtraction operator named '-'. The semantics are sufficiently different that a subtraction operation on unsigneds should stand out.

(I am not a fan of using unsigned integers for semantically non-negative numbers. They are not simply a non-negative bounded type; they are a different type of integer, with a different arithmetic not familiar to everyday maths. But this is a tough row to hoe in C. Other languages, like Java and C#, didn't inherit the same mistake.)



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

Search: