我在项目代码中遇到编译错误,情况如下:
typedef unsigned int U32bit;
typedef unsigned long long U64bit;
U32bit var;
U64bit var2;
var = function(); /* Function returns a 32-bit value, which is stored in var */
var2 = 100*var1; /* 100*var1 is very Big & can be stored only in U64bit variable */
For the Above Line: var2 = 100*var1
我在 Solaris 上收到以下编译错误:
"conversion to non-scalar type requested"
我也尝试过类型转换:
var2 = (U64bit) 100*var1;
这也给出了同样的错误。