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
1
u/EggplantExtra4946 May 07 '26
You are being ridiculous. And also there is a simpler way:
for (size_t i = length-1; i < length; i--) { array[i] }James Gosling or not I doubt that this is true.
How are integer overflows in multiplications a problem about unsigned integers exactly and how come signed integers wouldn't have the exact same problem?
Except that malloc malloc worked as expected. Again this has absolutely nothing to do with unsigned integers.
The idea that it wouldn't be supported is ridiculous.
Stop it with your hysteria. Unsigned integers are used, so what?
If your type system/type infererence system is too rigid it's your fault. There is no reason why 0, 1, 2, 3, 4, 0x100, 0x1000 should necessarily be signed and why those literals couldn't be safely implicitly casted to unsigned or vice versa.
Yes but if you want to mix signed and unsigned there is a problem with the coherency of your program. Almost everytime this situations like these will arise is if you insist on using signed in the first place which you don't need at all for general purpose programming, aka strings, buffers, arrays, data structures, etc..
This so fucking stupid how is it even an solution? For one thing you're not removing jack shit because signed and unsigned cpu instruction (and therefore the bit pattern semantics of the corresponding language operators) are the exact same, except for comparisons and right shift. Also things like multiplcations where the result has twice the width of the operands but languages don't support that.
You need unsigned comparisons, you need logical right shift, you need zero extensions.
When you read a byte from a string, you want to do if (byte < 0x80), you can't do that with int8_t.
You are being dishonnest about the problem of mixing signed and unsigned. Clearly you think this is unsigned's fault, you never consider that signed integers are equally at fault. Maybe the issue is that you use signed everywhere.
I can't even see why you would use signed integers anyway. For the arithmetic you need to do for usual memory and data structure operations, signed integers have no use. In a program for converting fahrenheit to celsius degree I would use signed integers, but for writing an interpreter or compiler? Nope.