开发平台(Platform): (Ex: Win10, Linux, ...)
win7
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
keil C
问题(Question):
程式码里面红色那行会 warining
multiple unsequenced modifications to 'm_rs2CmdLen'
如何改比较好
程式码(Code):(请善用置底文网页, 记得排版)
volatile uint16_t m_rs2CmdLen;
volatile int m_rc;
static char m_rs2CmdBuf[255];
void main (void)
{
m_rs2CmdLen = 0;
while (TRUE)
{
if (m_rc >= 0)
{
m_rs2CmdBuf[m_rs2CmdLen] = (char) m_rc;
m_rs2CmdLen = (++m_rs2CmdLen & 255);
if (m_rc == ASCII_CR) /* m_rc == "\r" char_0x0D */
{
m_rc = cmdRS2Interpreter(m_rs2CmdBuf, m_rs2CmdLen);
m_rs2CmdLen = 0;
}
}
}
}
补充说明(Supplement):
m_rs2CmdLen++;
m_rs2CmdLen = m_rs2CmdLen & 255;
想改成这样 应该没有违背原作者意思吧