PVS-StudioWarnings

PVS-Studio warning V584 for FAR

Nov 12th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. enum FINDASKDLGCOMBO
  2. {
  3.   FADC_ALLDISKS,
  4.   ...
  5. };
  6.  
  7. FindFiles::FindFiles()
  8. {
  9.   ...
  10.   if (FADC_ALLDISKS+SearchMode==FADC_ALLDISKS ||
  11.       FADC_ALLDISKS+SearchMode==FADC_ALLBUTNET)
  12.   ...
  13. }
  14.  
  15. A strange expression FADC_ALLDISKS+SearchMode==FADC_ALLDISKS can be simplified to SearchMode == 0.
  16.  
  17. This suspicious code was found in FAR project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V584 The 'FADC_ALLDISKS' value is present on both sides of the '==' operator. The expression is incorrect or it can be simplified. far findfile.cpp 3317
  20.  
  21. 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