From the answers I got from this question, it appears that C++ inherited this requirement for conversion of short
into int
when performing arithmet
It's not a feature of the language as much as it is a limitation of physical processor architectures on which the code runs. The int
typer in C is usually the size of your standard CPU register. More silicon takes up more space and more power, so in many cases arithmetic can only be done on the "natural size" data types. This is not universally true, but most architectures still have this limitation. In other words, when adding two 8-bit numbers, what actually goes on in the processor is some type of 32-bit arithmetic followed by either a simple bit mask or another appropriate type conversion.