2

我有以下变量:

UWORD64 length;     
UWORD32 thumbnail_offset;
UWORD32 thumbnail_length;
UWORD64 sum;

这就是我想要做的:

sum = (UWORD64)(thumbnail_offset + thumbnail_length);
main_image_length = (UWORD32)(length - sum);

但是,第一行给了我错误:conversion to non-scalar type requested

第二行给了我错误:二进制的无效操作数-(有'UWORD64'和'UWORD64')

我不明白问题是什么。不应该提升低等的类型吗?为什么这会引起问题?

4

1 回答 1

2

它可能是类型 def 或未定义的值。我正在使用 MSVC 2012 并且只使用 Microsoft 内置类型。编译没有问题。

unsigned __int64 length = 100;     
unsigned __int32 thumbnail_offset = 32;
unsigned __int32 thumbnail_length = 25000000;
unsigned __int64 sum = 0;
unsigned __int32 main_image_length = 0;

//And this is what I want to do:

sum = (unsigned __int64 )(thumbnail_offset + thumbnail_length);
main_image_length = (unsigned __int32)(length - sum);
于 2012-11-14T04:35:03.523 回答