suggest parentheses around comparison in operand of &|


warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]

該警告希望你在&(邏輯與)表達式左右加上括號。有的時候&&(邏輯且)少寫了一個&,也會產生該警告。

例如:   if((a[2]>>1)&0x1 == 1){ 

             .........

          }
應該將 (a[2]>>1)&0x1 用()號括起來。因為&運算符的優先級較低,低於==和!=運算符。



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM