PVS-StudioWarnings

PVS-Studio warning V519 for QuantLib

Nov 18th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. boost::shared_ptr<VanillaOption> makeOption(....)
  2. {
  3.   switch (engineType) {
  4.   case CRR:
  5.     engine = boost::shared_ptr<PricingEngine>(
  6.       new BinomialVanillaEngine<ExtendedCoxRossRubinstein>(..));
  7.   case EQP:
  8.     engine = boost::shared_ptr<PricingEngine>(
  9.       new BinomialVanillaEngine<
  10.         ExtendedAdditiveEQPBinomialTree>(..));
  11.     break;
  12.   ....
  13. }
  14.  
  15. The break operator is missing.
  16.  
  17.  
  18. This suspicious code was found in QuantLib project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V519 The 'engine' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 98, 103. extendedtrees.cpp 103
  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