r/ProgrammingLanguages • u/Nuoji C3 - http://c3-lang.org • May 03 '26
Blog post Unsigned Sizes: A Five Year Mistake
https://c3-lang.org/blog/unsigned-sizes-a-five-year-mistake/
91
Upvotes
r/ProgrammingLanguages • u/Nuoji C3 - http://c3-lang.org • May 03 '26
View all comments
Show parent comment
4
u/matthieum May 04 '26
That's a bold assertion.
In particular, you'd first to justify why unsigned?
Unsigned integers have one, big, glaring issue: the most common value for an integer to have (0) is right at the edge of the representable range. It's very easy to overflow an unsigned integer (
u-1overflows ifu == 0).Signed integers tend to behave a LOT better. Sure there's some risks of overflowing close to MIN/MAX, but those are not nearly as common as 0, 1 and 2.
And even better, when signed integers overflow, you typically get dumb results. Like a negative number when you expected a positive one. Much easier to notice.