This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 编译器/TMS320F28069:编译器无法键入将两个 uint16_t 值的 rvalue 9乘法转换为 lvalue uint32_t

Guru**** 2524550 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/941058/compiler-tms320f28069-compiler-fails-to-type-cast-an-rvalue-9multiplication-of-two-uint16_t-values-to-an-lvalue-uint32_t

器件型号:TMS320F28069

工具/软件:TI C/C++编译器

cl2000

我有两个变量

volatile uint16_t wdDelay = 500;

volatile uint32_t dwTemp = 0;

操作:

dwTemp =(wdDelay * 1000);

将 dwTemp 设定为0x0000 A120而不是0x0007 A120 = 500、000

为什么编译器在将结果移动到 dwTemp 之前不会自动键入将结果转换为 uin32_t? 或者我是否应该明确地这样做?