This is distinguished from a narrowing conversion, which may lose data.
这与收缩转换不同,后者可能丢失数据。
Explicit conversion is required by some compilers to support narrowing conversions.
有些编译器需要显式转换来支持收缩转换。
An example of a narrowing conversion is converting a 64-bit signed integer to a 32-bit signed integer.
缩小转换的范例是转换64位元带正负号的整数为32位元带正负号的整数。
Again, you must be aware of the effect of a narrowing conversion when casting to a smaller type, otherwise you might unknowingly lose information during the cast.
同样地,当造型成一种较小的类型时,必须留意“缩小转换”的后果。否则会在造型过程中不知不觉地丢失信息。
If you relax the type-conversion rule, the compiler operates under permissive type semantics, which allows you to make narrowing conversions without conversion keywords.
如果放宽类型转换规则,则编译器将在“许可类型语义”下操作,该语义允许在不使用转换关键字的情况下进行收缩转换。
This would only happen if the value were a "narrowing conversion," where a value exceeded the possible range value allowed in the new type, such as trying to convert from long to int, for example.
只有当一个值 “转换为范围更小的类型” 时,即这个值超出了新类型允许的范围,例如试图从long 类型转换为int 类型,才会发生这样的情况。
Define conversion operators to simplify narrowing and widening conversions between numeric types.
定义转换操作符来简化数字类型之间的缩小和放大转换。
A conversion, either widening or narrowing, must be possible between the element types of the two arrays.
必须可以在两个数组的元素类型间进行转换(扩大转换或收缩转换)。
A conversion of one array type to another is widening or narrowing depending on whether the conversion of the respective elements is widening or narrowing.
一种数组类型到另一种数组类型的转换是扩展转换还是双字节到单字节转换,取决于各自元素的转换是扩展转换还是双字节到单字节转换。
If one of these conversions is widening, the reverse conversion might be narrowing.
如果其中一个转换是扩展转换,反向转换便是缩小转换。
A procedure is called with an argument that widens to the corresponding parameter type, and the conversion from the parameter to the argument is narrowing.
调用过程时使用扩大到对应参数类型的变量,从参数到变量的转换则为缩小转换。
A procedure is called with an argument that widens to the corresponding parameter type, and the conversion from the parameter to the argument is narrowing.
调用过程时使用扩大到对应参数类型的变量,从参数到变量的转换则为缩小转换。
应用推荐