PVS-StudioWarnings

PVS-Studio warning V572 for Cocos2d-x

Nov 17th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. struct Tile
  2. {
  3.   Vec2    position;
  4.   Vec2    startPosition;
  5.   Size    delta;
  6. };
  7.  
  8. Tile* _tiles;
  9.  
  10. void ShuffleTiles::startWithTarget(Node *target)
  11. {
  12.   ....
  13.   _tiles = (struct Tile *)new Tile[_tilesCount];  //<==
  14.   Tile *tileArray = (Tile*) _tiles;               //<==
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in Cocos2d-x project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V572 It is odd that the object which was created using 'new' operator is immediately casted to another type. ccactiontiledgrid.cpp 322
  21.  
  22. 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