Boost logo

Boost :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2006-08-19 05:32:13


On 8/19/06, Martin Wille <mw8329_at_[hidden]> wrote:
> Frederick Akalin wrote:
> > When compiling the example programs for dynamic_bitset with MSVC++ 8.0,
> > I get the following message:
> >
> > C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\xutility(2841) :
> > warning C4996: 'std::_Fill_n' was declared deprecated
> >
> > and an exhortation to use the "Safe Standard C++ Library".
> >
> > As my first task as dynamic_bitset's maintainer, I want to modify it to
> > not trigger this warning. Unfortunately, unlike most of the other
> > functions that trigger this warning which have _s alternatives, the only
> > alternative to std::fill_n I could find is MS's "safe" version in their
> > standard library extension. There's a preprocessor switch I can set,
> > (_CRT_SECURE_NO_DEPRECATE) but I believe it has to be set globally, as
> > it seemed to have no effect when I included it in dynamic_bitset.hpp.
> >
> > Does this affect any other libraries? Am I missing anything? What is
> > the best way to solve this?

You should encase your header in warning pragmas:

#if defined(_MSC_VER) && _MSC_VER >= 1400
#pragma warning(push)
#pragma warning(disable:4996)
#endif

/* your stuff */

#if defined(_MSC_VER) && _MSC_VER >= 1400
#pragma warning(pop)
#endif

>
> IMO, MS is not in a position to deprecate anything in the C++ standard.
> So it makes perfect sense to ignore this problem totally and let the
> user handle it by properly disabling this annoyance. I don't see any
> need for an action on the Boost side.
>

I agree Microsoft has no place deprecating C++ features, but having
Boost headers generate this warning may make unsuspecting developers
believe it is truly unsafe or, even worse, shops which have a strict
no-warning policy may not be able to use Boost because PMs won't let
them use the above pragmas in their code.

Perhaps there should be a set of headers which handle this that Boost
library makers can include at the top and bottom of their headers.

>
> Regards,
> m
> Send instant messages to your online friends http://au.messenger.yahoo.com
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Cory Nelson
http://www.int64.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk