本文共 325 字,大约阅读时间需要 1 分钟。
在看到此文章之间,就问有多少人知道自动类型转换的事情?
说明如下:
A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T)((E1) op (E2)), where T is the type of E1, except that E1 is evaluated only once.
什么意思?就是+=类算符,自动带有类型转换功能。那么C呢?其他语言呢?
纵横编程界这么多年,从来都认为高精度不能赋值给低精度,除非进行类型转换(造型)。结果这次被告知,本来就如此。吾就问,这样的理由是什么?
转载地址:http://ctuaf.baihongyu.com/