PVS-StudioWarnings

PVS-Studio warning V636 for Micro-Manager

Nov 19th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. int SpectralLMM5Interface::GetTransmission(....,
  2.                                            double& transmission)
  3. {
  4.   ....
  5.   int16_t tr = 0;
  6.   memcpy(&tr, answer + 1, 2);
  7.   tr = ntohs(tr);
  8.   transmission = tr/10;
  9.   ....
  10. }
  11.  
  12. This suspicious code was found in Micro-Manager project by PVS-Studio static code analyzer.
  13. Warning message is:
  14. V636 The 'tr / 10' expression was implicitly casted from 'int' type to 'double' type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) / Y;. SpectralLMM5Interface.cpp 198
  15.  
  16. 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