Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Arrays
- {
- ....
- bool equals( class1* val1, class2* val2 ) const{
- static _comparator comp;
- if ( val1 == val2 )
- return true;
- size_t size = val1->size();
- if ( size != val2->size() )
- return false;
- _itr1 itr1 = val1->begin();
- _itr2 itr2 = val2->begin();
- while ( --size >= 0 ){
- if ( !comp(*itr1,*itr2) )
- return false;
- itr1++;
- itr2++;
- }
- return true;
- }
- ....
- }
- This suspicious code was found in CLucene project by PVS-Studio static code analyzer.
- Warning message is:
- V547 Expression '-- size >= 0' is always true. Unsigned type value is always >= 0. arrays.h 154
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment