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
2
u/Nuoji C3 - http://c3-lang.org May 09 '26
Interestingly enough, given that you need to check that a signed value is in the interval
0 <= x <= MAX, you only need to check(unsigned)x <= MAX, and usually compilers already optimize for this fact, so you can write it asx >= 0 && x <= MAXwithout it being two checks.