http://quantlib.414.s1.nabble.com/Interest-in-fixing-MSVC-Level-4-warnings-tp13868p14081.html
I apologize for the late follow up to looking into getting these warnings fixed, but I have a VC++ 2012 warning free fork of the github mirror at
https://github.com/masrtis/quantlib. I've created a branch, VC11Level4WarningFixes, that contains the changes I've made.
The vast majority of warnings were C4512: cannot generate an assignment operator for 'class'. This is because of the use of const members and references in classes. To silence these warnings as I was going through, I used boost::noncopyable and that seems to be a bit overkill. Ideally it would be nice to fix these warnings by adding a similar class that just disables the assignment operator for classes with const members and maybe keep using boost::noncopyable if a class has reference members, but I think the amount of files affected for the amount of benefit gained is pretty small. Because of this, I recommend not merging down the entire branch.
I did, however, find some bugs and do some minor refactoring for other warnings. I've created tags on the branch that mark changes that should be made and also changes that would be good to get reviewed. A summary of these is below.
FIX1: Disables the conditional expression is constant warning for the QL_FAIL macro using Microsoft specific pragmas that work correctly with macro expansion. It's worth considering because this change fixes 1,276 warnings on its own.
FIX2: Removes unreachable code from CPICouponPricer::optionletPriceImp. I wasn't sure if the code was left in for documentation purposes, but if so it should be commented out.
FIX3: Disables a bunch of warnings that leaked from uBLAS headers.
FIX4: Replaced a runtime check of a numeric template parameter with BOOST_STATIC_ASSERT to catch the programming error at compile time instead of runtime.
FIX5: Fixed uninitialized variable in CPICapFloorTermPriceSurface.
FIX6: Fixed uninitialized variable in CPICapFloor.
FIX7: Refactored code in Concentrating1dMesher to improve variable scope.
REVIEW1: I wasn't sure why RendistatoCalculator was using private inheritance from LazyObject. I fixed the warning by using boost::noncopyable, but I suspect there's a missing public keyword here.
FIX8: Disables some more warnings from uBLAS.
REVIEW2: There might need to be some code added to the check a return value in Garch11::calibrate_r2().
FIX9: Remove a duplicated return statement from OptionletStripper::optionletStrikes().
FIX10: Added a static_cast around a toupper() call in PeriodParser::parseOnePeriod() to silence a size conversion warning.
REVIEW3, REVIEW4: There is a lot of commented out code in function bodies in experimental/credit/distribution.cpp and experimental/credit/lossdistribution.cpp. I ended up commenting out what appeared to be similar code that was actually active and therefore generating unreachable code warnings. It's worth reviewing these files to see if the commented out code is still needed.
FIX11: Made sure that a const array declaration in math/randomnumbers/primitivepolynomials.h was always considered extern, even when it was included in the companion .c file.
FIX12: Disabled a conditional expression is constant warning in ZigguratRng::nextGaussian().
FIX13: Added files to the VC11 projects that were checked in after I had created my branch.
I hope this information is useful. Let me know if there's any questions or if I can do anything to help get these changes integrated into quantlib.
Mike
Everyone hates slow websites. So do we.