[Boost-bugs] [Boost C++ Libraries] #9503: Compile error C4996 with boost::uuids:uuid and vc2012

Subject: [Boost-bugs] [Boost C++ Libraries] #9503: Compile error C4996 with boost::uuids:uuid and vc2012
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-12-17 16:05:36


#9503: Compile error C4996 with boost::uuids:uuid and vc2012
----------------------------------------+------------------------------
 Reporter: Craig Hutchinson <craig@…> | Type: Patches
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.55.0
 Severity: Problem | Keywords: C4996 vc2012
----------------------------------------+------------------------------
 When compiling uuid under vc2012 with safe check enabled the C4996 warning
 is escalated to ERROR status.

 {{{
 c:\program files (x86)\microsoft visual studio
 11.0\vc\include\algorithm(965): error C4996: 'std::_Swap_ranges': Function
 call with parameters that may be unsafe - this call relies on the caller
 to check that the passed values are correct. To disable this warning, use
 -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++
 'Checked Iterators'
 1> c:\program files (x86)\microsoft visual studio
 11.0\vc\include\algorithm(950) : see declaration of 'std::_Swap_ranges'
 1> c:\boost\boost_1_55_0\boost\uuid\uuid.hpp(151) : see reference
 to function template instantiation '_FwdIt2
 std::swap_ranges<boost::uuids::uuid::iterator,boost::uuids::uuid::iterator>(_FwdIt1,_FwdIt1,_FwdIt2)'
 being compiled
 1> with
 1> [
 1> _FwdIt2=boost::uuids::uuid::iterator,
 1> _FwdIt1=boost::uuids::uuid::iterator
 1> ]
 }}}

 The pragma that already exists in boost_1_55_0\boost\uuid\uuid.hpp does
 not cater for this:
 {{{
 #pragma warning(disable : 4996)
 }}}

 I have attached a modified uuid which uses std::array as a sensible
 solution - this was actually commented in the original code. Now this
 enables safe iterators for compiler checks to be performed and removed any
 need for the #pragma pre-processor directives. There may be other changes
 needed elsewhere(i.e. &*uuid.begin() in functions needing void*).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9503>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC