r/C_Programming • u/Low_Minimum9920 • Jun 15 '26
Question Question regarding unsigned integers
What's the difference between an unsigned int and a normal integer?
11
Upvotes
r/C_Programming • u/Low_Minimum9920 • Jun 15 '26
What's the difference between an unsigned int and a normal integer?
View all comments
Show parent comment
1
u/flatfinger Jun 15 '26
The published Rationale suggests the reason that the Standard doesn't specify that an expression like
uint1 = ushort1*ushort2;should use unsigned math even if all values ofunsigned shortcan be represented assigned intis not that nobody knew how implementations for common hardware should process results between INT_MAX+1u and UINT_MAX, but rather that they had always processed such cases the same way and there was no reason to expect that in the absence of a mandate they might do otherwise.