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.

[参考译文] MSP430FR2355:三态运算符问题

Guru**** 2516170 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1117072/msp430fr2355-ternary-operator-question

器件型号:MSP430FR2355

我在尝试编译这个甚至是简单的东西时仍然遇到错误...有人能告诉我我我发生了什么错误(通常我在条件下使用、但决定尝试一下)

((uint8_t)((float)clkSpeed / smClkDiv) % 4) == 0 ? error = error : error = 1;

无论我尝试得到什么都是如此


Description	Resource	Path	Location	Type
#138 expression must be a modifiable lvalue	systemComms.c	/systemComms	line 30	C/C++ Problem

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

    一位三元运算符需要分配给某个对象、因此您需要说:

    ERROR =((uint8_t)((float) clkSpeed / smClkDiv)% 4)= 0? 错误:1;