首页 > 其他 > 详细

suggest parentheses around comparison in operand of &|

时间:2018-06-19 10:04:03      阅读:269      评论:0      收藏:0      [点我收藏+]

error discription:

.cpp:187:25: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
         if (data_cur[j] == 255 & data_pre[j] == 255) temp.at<uchar>(i, j) = 255
                

why:

该警告希望你在&(逻辑与)表达式左右加上括号。有的时候&&(逻辑且)少写了一个&,也会产生该警告。

因为&运算符的优先级较低,低于==和!=运算符。

if ( (data_cur[j] == 255) && (data_pre[j] == 255) ) temp.at<uchar>(i, j) = 255;

RE

1.cnblogs-here;

End

suggest parentheses around comparison in operand of &|

原文:https://www.cnblogs.com/happyamyhope/p/9197230.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!