PVS-StudioWarnings

PVS-Studio warning V501 for WinMerge

Nov 26th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. bool
  2. isopenbrace (TCHAR c)
  3. {
  4.   return c == _T ('{') || c == _T ('(') ||
  5.          c == _T ('[') || c == _T ('<');
  6. }
  7.  
  8. bool
  9. isclosebrace (TCHAR c)
  10. {
  11.   return c == _T ('}') || c == _T ('}') ||
  12.          c == _T (']') || c == _T ('>');
  13. }
  14.  
  15. The variable in the second function is compared to '} twice. A comparison to the ')' character is missing.
  16.  
  17. This suspicious code was found in WinMerge project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V501 There are identical sub-expressions to the left and to the right of the '||' operator: c == L'}' || c == L'}' Merge ccrystaleditview.cpp 1556
  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