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.

为什么程序运行顺序和代码顺序不一致?



自己单步调试的时候发现程序会跳过几行代码,比如

for(i = 0; i < PrimeSetSize; i++)
{
PrimeSetsum += PrimeSet[i];
}

而且看到的执行顺序与自己实际要求的不一。

有没有人遇到过这种问题呢?

  • 单步调试的时候disable optimization level,即关闭优化;另外在ccs中有时候代码执行会错行,例如看到的代码在line12,但是单步调测发现断点只能打在line13,这只是单步观测的现象,但是代码执行顺序还是正确的。至于你说的跳过几行没有遇到过。