给定下面的C/C++ 语句, flexe-lint (9.00e) 会给出下面的错误判断:
unsigned int heartbeat_count = (unsigned int)-1;
bool cond_3 = (heartbeat_count+1==0 );
test.c 39 Warning 587: Predicate '==' can be pre-determined and always evaluates to False
显然, 如果heartbeat_count值为 (unsigned int)-1; 则与1相加结果为0.
阅读(1318) | 评论(0) | 转发(0) |