使用IAR编译时使用2个volatile变量在同一语句时出如下警告
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
查资后得知大体原因:volatile变量一般使用在多线程等场合,如果同一语句使用2个此变量,会出现访问顺序不可预知的后果,所以要解决此问题可以把其中一个先读取存放到一个局部变量中,再和另一个进行运算
转载请注明http://www.cdle.net
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
查资后得知大体原因:volatile变量一般使用在多线程等场合,如果同一语句使用2个此变量,会出现访问顺序不可预知的后果,所以要解决此问题可以把其中一个先读取存放到一个局部变量中,再和另一个进行运算
转载请注明http://www.cdle.net