Advertisement
PVS-StudioWarnings

PVS-Studio warning V511 for Source SDK

Nov 27th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
  2. #define _ARRAYSIZE(A)   RTL_NUMBER_OF_V1(A)
  3.  
  4. int GetAllNeighbors( const CCoreDispInfo *pDisp,
  5.                      int iNeighbors[512] )
  6. {
  7.   ....
  8.   if ( nNeighbors < _ARRAYSIZE( iNeighbors ) )
  9.     iNeighbors[nNeighbors++] = pCorner->m_Neighbors[i];
  10.   ....
  11. }
  12.  
  13. This suspicious code was found in Source SDK project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V511 The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof (iNeighbors)' expression. Vrad_dll disp_vrad.cpp 60
  16.  
  17. 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