PVS-StudioWarnings

PVS-Studio warning V596 for OpenMS

Nov 26th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. inline UInt asUInt_(const String & in)
  2. {
  3.   UInt res = 0;
  4.   try
  5.   {
  6.     Int tmp = in.toInt();
  7.     if (tmp < 0)
  8.     {
  9.       Exception::ConversionError(__FILE__, __LINE__,
  10.                                  __PRETTY_FUNCTION__, "");
  11.     }
  12.     res = UInt(tmp);
  13.   }
  14.   catch (Exception::ConversionError)
  15.   {
  16.     error(LOAD,
  17.           String("UInt conversion error of \"") + in + "\"");
  18.   }
  19.   return res;
  20. }
  21.  
  22. This suspicious code was found in OpenMS project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V596 The object was created but it is not being used. The 'throw' keyword could be missing: throw ConversionError(FOO); xmlhandler.h 247
  25.  
  26. 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