Boost C++ Libraries: Ticket #5771: warning C4996 occurs during compilation of basic_binary_iprimitive::load_binary because of the call to sgetn method https://svn.boost.org/trac10/ticket/5771 <p> warning C4996 occurs during compilation of basic_binary_iprimitive::load_binary because of the call to <strong>sgetn</strong> method: </p> <p> <em> warning C4996: 'std::basic_streambuf&lt;_Elem,_Traits&gt;::sgetn': 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' e:\boost\include\boost-1_46_1\boost\archive\basic_binary_iprimitive.hpp 161 </em> </p> <p> Minimal code to reproduce: </p> <pre class="wiki">#include &lt;boost/archive/binary_iarchive.hpp&gt; </pre><p> easy solution for this is to use <strong><a class="ext-link" href="http://msdn.microsoft.com/en-us/library/aa985925%28VS.80%29.aspx"><span class="icon">​</span>_Sgetn_s</a></strong> for VC 8.0 and higher. </p> <p> Patch with a quick fix is attached to the ticket. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5771 Trac 1.4.3 Anton Matosov <anton.matosov@…> Wed, 10 Aug 2011 21:21:12 GMT attachment set https://svn.boost.org/trac10/ticket/5771 https://svn.boost.org/trac10/ticket/5771 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">warning in basic_binary_iprimitive.hpp.patch</span> </li> </ul> Ticket anonymous Thu, 11 Aug 2011 03:54:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5771#comment:1 https://svn.boost.org/trac10/ticket/5771#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I've looked at the patch. I'm loath to start going down this path. Basically the microsoft version is not standard conforming. To start doing this I'd have to do this all over the code and I'm not inclined to do it. The benefit would not be worth all the effort. It would also make the code harder to read than it already is. You can eliminate these warnings with a compile time switch. </p> <p> Robert Ramey </p> Ticket