PVS-StudioWarnings

PVS-Studio warning V524 for MAME

Nov 18th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. class device_disasm_interface : public device_interface
  2. {
  3.   ...
  4. public:
  5.   UINT32 min_opcode_bytes() const
  6.    { return disasm_min_opcode_bytes(); }
  7.   UINT32 max_opcode_bytes() const
  8.    { return disasm_max_opcode_bytes(); }
  9.   ...
  10. }
  11.  
  12. class device_debug
  13. {
  14.   device_disasm_interface *m_disasm;
  15.   ...
  16.   int min_opcode_bytes() const
  17.     {
  18.       return (m_disasm != NULL) ?
  19.         m_disasm->max_opcode_bytes() : 1;
  20.     }
  21.   int max_opcode_bytes() const
  22.     {
  23.       return (m_disasm != NULL) ?
  24.         m_disasm->max_opcode_bytes() : 1;
  25.     }
  26. }
  27.  
  28. This suspicious code was found in MAME project by PVS-Studio static code analyzer.
  29. Warning message is:
  30. V524 It is odd that the body of 'max_opcode_bytes' function is fully equivalent to the body of 'min_opcode_bytes' function (debugcpu.h, line 150).  debugcpu.h 151
  31.  
  32. 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