Advertisement
PVS-StudioWarnings

PVS-Studio warning V524 for SeqAn

Nov 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. template<typename TIntervals, typename TValue>
  2. TValue
  3. _calcIntervalTreeNodeCenterLeft(TIntervals & intervals,
  4.    TValue &, TValue &, Tag<TagRandomCenter_> const)
  5. {
  6.   SEQAN_CHECKPOINT
  7.   TValue rand_index = rand()%length(intervals);
  8.   return (rightBoundary(*value(intervals,rand_index))+
  9.           leftBoundary(*value(intervals,rand_index)))
  10.          /(TValue)2.0;
  11. }
  12.  
  13. template<typename TIntervals, typename TValue>
  14. TValue
  15. _calcIntervalTreeNodeCenterRight(TIntervals & intervals,
  16.   TValue &, TValue &, Tag<TagRandomCenter_> const)
  17. {
  18.   SEQAN_CHECKPOINT
  19.   TValue rand_index = rand()%length(intervals);
  20.   return (rightBoundary(*value(intervals,rand_index))+
  21.           leftBoundary(*value(intervals,rand_index)))
  22.          /(TValue)2.0;
  23. }
  24.  
  25. This suspicious code was found in SeqAn project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V524 It is odd that the body of '_calcIntervalTreeNodeCenterRight' function is fully equivalent to the body of '_calcIntervalTreeNodeCenterLeft' function. misc_interval_tree.h 1216
  28.  
  29. 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