are automatically performed when a value is copied to a compatible type. For example:
Here, the value of a is promoted from short
without the need of any explicit operator. This is known as a standard conversion
. Standard conversions affect fundamental data types, and allow the conversions between numerical types (short
...), to or from bool
, and some pointer conversions.
Converting to int
from some smaller integer type, or to double
is known as promotion
, and is guaranteed to produce the exact same value in the destination type.