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
6
u/QuaternionsRoll May 04 '26
I’ve always wondered what it would be like if casting were performed on outputs rather than inputs. Define arithmetic operations such that they can never overflow (e.g.
i32 + u32 -> i34) and then require the user to deal with casting the result (i34) to the type they actually need (i32,u32, etc.). Compilers are generally smart enough to eliminate the extra operations when the result is subject to a wrapping cast anyway.