Until recently, I\'d considered the decision by most systems implementors/vendors to keep plain int
32-bit even on 64-bit machines a sort of expedient wart. With mo
As you say, I think that the promotion rules really are the killer. uint32_t
would then promote to int
and all of a sudden you'd have signed arithmetic where almost everybody expects unsigned.
This would be mostly hidden in places where you do just arithmetic and assign back to an uint32_t
. But it could be deadly in places where you do comparison to constants. Whether code that relies on such comparisons without doing an explicit cast is reasonable, I don't know. Casting constants like (uint32_t)1
can become quite tedious. I personally at least always use the suffix U
for constants that I want to be unsigned, but this already is not as readable as I would like.
Also have in mind that uint32_t
etc are not guaranteed to exist. Not even uint8_t
. The enforcement of that is an extension from POSIX. So in that sense C as a language is far from being able to make that move.