0
点赞
收藏
分享

微信扫一扫

suggest parentheses around comparison in operand of &|

您好 2022-07-13 阅读 43

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

举报

相关推荐

0 条评论