Subject: [Boost-bugs] [Boost C++ Libraries] #9621: dynamic_bitset.hpp MSVC compiler warning C4996 in call to std::fill_n
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-01-30 22:18:28
#9621: dynamic_bitset.hpp MSVC compiler warning C4996 in call to std::fill_n
-----------------------------------------+----------------------------
Reporter: Drew Foster <drew.foster@â¦> | Owner: jsiek
Type: Patches | Status: new
Milestone: To Be Determined | Component: dynamic_bitset
Version: Boost 1.54.0 | Severity: Problem
Keywords: |
-----------------------------------------+----------------------------
When using the MSVC 12.0 compiler (and earlier versions) with
dynamic_bitset, the following compiler warning is generated...
1>C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\xutility(2715): warning C4996: 'std::_Fill_n': 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
12.0\VC\include\xutility(2701) : see declaration of 'std::_Fill_n'
1>
d:\devel\drew.fosterTfs\3rdParty\Boost\1.54\main\dynamic_bitset\boost/dynamic_bitset/dynamic_bitset.hpp(810)
: see reference to function template instantiation '_OutIt
std::fill_n<unsigned long*,boost::dynamic_bitset<unsigned
long,std::allocator<Block>>::size_type,unsigned long>(_OutIt,_Diff,const
_Ty &)' being compiled
1> with
1> [
1> _OutIt=unsigned long *
1> , Block=unsigned long
1> , _Diff=boost::dynamic_bitset<unsigned
long,std::allocator<unsigned long>>::size_type
1> , _Ty=unsigned long
1> ]
As noted in other threads
(http://lists.boost.org/Archives/boost/2006/08/109338.php), this is a
shortcoming of the Microsoft compiler.
It can be easily fixed by modifying line 810 in dynamic_bitset.hpp to use
an iterator for the first parameter instead of a raw pointer in the call
to std::fill_n.
- std::fill_n(b, div, static_cast<block_type>(0));
+ std::fill_n(m_bits.begin(), div,
static_cast<block_type>(0));
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9621> 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