MSVC++ 8.0 warning C4996 and std::fill_n

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? Frederick Akalin

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?
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. Regards, m Send instant messages to your online friends http://au.messenger.yahoo.com

On 8/19/06, Martin Wille <mw8329@yahoo.com.au> 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

Cory Nelson wrote:
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
I tried this--encasing the offending line in the header--and it didn't work. I was puzzled because I had searched online and found multiple sources that recommended that. However, I found this page: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac... Apparently, the warning is triggered in the line in the header file (xutility, in my case), and not in the line in my code. That means that the warning will be disabled only if I put the pragmas above before including any stdlib headers. Unfortunately, that is up to the client code, and it makes writing a header for this difficult. This will be changed in SP1, but it seems like there's little library writers can do now. This page: http://www.boost.org/tools/build/v1/vc-8_0-tools.html also recommends the client turn off that warning globally or wrap all that headers in that pragma. Looks like I have to live with this until SP1. Frederick Akalin

On Sat, 19 Aug 2006 14:46:27 -0700, Frederick Akalin <akalin@akalin.cx> wrote:
However, I found this page:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac...
My God... Whatever they touch they transform it into a mess :-/ Really if these people changed job we would all have a happier life. -- [ Gennaro Prota. C++ developer, Library designer. ] [ For Hire http://gennaro-prota.50webs.com/ ]
participants (4)
-
Cory Nelson
-
Frederick Akalin
-
Gennaro Prota
-
Martin Wille