I was hoping to start using Visual Studio 2005 as my primary Windows compiler, but this warning from the boost home page was holding me back:

Note: Boost does not support the non-standard “Safe” C++ Library shipping with Visual C++ 8.0, which may result in many spurious warnings from Boost headers and other standards-conforming C++ code. To suppress these warnings, define the macro _SCL_SECURE_NO_DEPRECATE.

Digging further on boost.org…

The implementation of the standard C++ library bundled with Visual C++ .NET 2005 might issue a number of spurious warnings feature is deprecated when using Boost headers. The warnings come from the “Safe” C++ Library, which labels many standard C and C++ library constructs as deprecated when in fact they may be used safely and correctly. Define _SCL_SECURE_NO_DEPRECATE globally to eliminate these errors. Alternatively, you can enclose all includes of Boost headers and C++ standard library headers with #pragma warning(disable:4996), as demonstrated below:

#pragma warning(push)
#pragma warning(disable : 4996)
#include
#include
#include
#include
#include
#pragma warning(pop)

So it sounds like Microsoft is basically saying “don’t use these standard C++ features as we’ve found them to be unsafe”. Fair enough, and it seems fairly harmless if you can easily disable the warnings. I’ve heard that Microsoft has a whole range of features that are illegal for including in any newly submitted code, e.g. all the crappy C string routines – MAN how much pain have THEY caused over their lifetimes. Wow, I just agreed with Microsoft.

Leave a Reply