【IAR警告】Warning[Pa082]
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
運(yùn)算符兩邊都是volatile變量的警告
這警告有意義.
用volatile修飾的變量一般不直接參與運(yùn)算,volatile就以為著這個(gè)變量在運(yùn)算過程中有可能已經(jīng)改變了
例如:想計(jì)算a * b 要這樣:
volatileunsignedchara;volatileunsignedcharb;unsignedcharx,y;x=a;y=b;return(x*y);
建議使用另外一個(gè)變量參與計(jì)算:
volatilecharVVV=9;charfun(){charxxx;charyyy=9;xxx=VVV;returnxxx*yyy}