When we perform any operation on unsigned short int it gets promoted to unsigned int even on a machine in which both data types have same size. What is the purpose of such a promotion ? How does it help ? Isn’t it just a change of name (since both have same size) ?
Share
The original mandate of the ANSI C committee was to codify existing practice, not create a new language.
And the C standard, in all its iterations through ANSI and ISO have taken backwards compatibility very seriously.
In other words, it’s done that way because it’s always been done that way 🙂
The reason the promotion is done is because the standard is for all implementations, including those where the sizes are different.
But I’m not sure what you’re complaining about. Promotion where the types are the same size is very unlikely to have a performance impact.