Boost C++ Libraries: Ticket #9621: dynamic_bitset.hpp MSVC compiler warning C4996 in call to std::fill_n https://svn.boost.org/trac10/ticket/9621 <p> When using the MSVC 12.0 compiler (and earlier versions) with dynamic_bitset, the following compiler warning is generated... </p> <p> 1&gt;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&gt; C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility(2701) : see declaration of 'std::_Fill_n' 1&gt; 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&lt;unsigned long*,boost::dynamic_bitset&lt;unsigned long,std::allocator&lt;Block&gt;&gt;::size_type,unsigned long&gt;(_OutIt,_Diff,const _Ty &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; _OutIt=unsigned long * 1&gt; , Block=unsigned long 1&gt; , _Diff=boost::dynamic_bitset&lt;unsigned long,std::allocator&lt;unsigned long&gt;&gt;::size_type 1&gt; , _Ty=unsigned long 1&gt; ] </p> <p> As noted in other threads (<a class="ext-link" href="http://lists.boost.org/Archives/boost/2006/08/109338.php"><span class="icon">​</span>http://lists.boost.org/Archives/boost/2006/08/109338.php</a>), this is a shortcoming of the Microsoft compiler. </p> <p> 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. </p> <ul><li> std::fill_n(b, div, static_cast&lt;block_type&gt;(0)); </li></ul><p> + std::fill_n(m_bits.begin(), div, static_cast&lt;block_type&gt;(0)); </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9621 Trac 1.4.3 acharles Fri, 21 Feb 2014 07:54:52 GMT owner, status changed https://svn.boost.org/trac10/ticket/9621#comment:1 https://svn.boost.org/trac10/ticket/9621#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jsiek</span> to <span class="trac-author">acharles</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket acharles Fri, 21 Feb 2014 07:55:46 GMT <link>https://svn.boost.org/trac10/ticket/9621#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9621#comment:2</guid> <description> <p> I have a local fix for this, I'll submit a pull request after my current one is accepted. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Fri, 21 Feb 2014 08:07:46 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/9621#comment:3 https://svn.boost.org/trac10/ticket/9621#comment:3 <ul> <li><strong>type</strong> <span class="trac-field-old">Patches</span> → <span class="trac-field-new">Bugs</span> </li> </ul> Ticket acharles Fri, 21 Feb 2014 09:24:46 GMT milestone changed https://svn.boost.org/trac10/ticket/9621#comment:4 https://svn.boost.org/trac10/ticket/9621#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> Ticket acharles Sun, 02 Mar 2014 01:58:33 GMT <link>https://svn.boost.org/trac10/ticket/9621#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9621#comment:5</guid> <description> <p> Fix is in develop. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Thu, 13 Mar 2014 21:42:53 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9621#comment:6 https://svn.boost.org/trac10/ticket/9621#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket