Advertisement
PVS-StudioWarnings

PVS-Studio warning V636 for Source SDK

Nov 25th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. virtual int GetMappingWidth( ) = 0;
  2. virtual int GetMappingHeight( ) = 0;
  3.  
  4. void CDetailObjectSystem::LevelInitPreEntity()
  5. {
  6.   ....
  7.   float flRatio = pMat->GetMappingWidth() /
  8.                   pMat->GetMappingHeight();
  9.   ....
  10. }
  11.  
  12. This suspicious code was found in Source SDK project by PVS-Studio static code analyzer.
  13. Warning message is:
  14. V636 The expression was implicitly casted from 'int' type to 'float' type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) / Y;. Client (HL2) detailobjectsystem.cpp 1480
  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
Advertisement