Boost C++ Libraries: Ticket #3194: compiler warnings in VC9 https://svn.boost.org/trac10/ticket/3194 <p> The following code under VC9 with warning level 4 produces the warnings below. Warnings are not allowed on my project, and rather than wrapping boost includes with a #pragma directive, I'd rather these warnings just be suppressed in the code that's causing them. </p> <p> boost::uint32_t <a class="missing wiki">GenerateChecksum</a>( const char* data, size_t length ) { </p> <blockquote> <p> boost::crc_32_type computer; </p> </blockquote> <blockquote> <p> computer = std::for_each( data, </p> <blockquote> <p> data + length, computer ); </p> </blockquote> </blockquote> <blockquote> <p> return computer(); </p> </blockquote> <p> } </p> <p> 2&gt;C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(377) : warning C4245: 'initializing' : conversion from 'int' to 'const boost::detail::mask_uint_t&lt;8&gt;::least', signed/unsigned mismatch 2&gt;C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(400) : warning C4245: 'initializing' : conversion from 'int' to 'const boost::detail::mask_uint_t&lt;16&gt;::least', signed/unsigned mismatch 2&gt;C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(574) : warning C4244: 'return' : conversion from 'unsigned int' to 'unsigned char', possible loss of data 2&gt; C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(574) : while compiling class template member function 'unsigned char boost::detail::crc_helper&lt;Bits,<a class="missing wiki">DoReflect</a>&gt;::index(unsigned int,unsigned char)' 2&gt; with 2&gt; [ 2&gt; Bits=32, 2&gt; <a class="missing wiki">DoReflect</a>=true 2&gt; ] 2&gt; C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(836) : see reference to class template instantiation 'boost::detail::crc_helper&lt;Bits,<a class="missing wiki">DoReflect</a>&gt;' being compiled 2&gt; with 2&gt; [ 2&gt; Bits=32, 2&gt; <a class="missing wiki">DoReflect</a>=true 2&gt; ] 2&gt; C:\Documents and Settings\Administrator\My Documents\Development\development\third_party\boost\1_39_0\boost/crc.hpp(836) : while compiling class template member function 'boost::crc_optimal&lt;Bits,<a class="missing wiki">TruncPoly</a>,<a class="missing wiki">InitRem</a>,<a class="missing wiki">FinalXor</a>,<a class="missing wiki">ReflectIn</a>,<a class="missing wiki">ReflectRem</a>&gt;::crc_optimal(unsigned int)' 2&gt; with 2&gt; [ 2&gt; Bits=32, 2&gt; <a class="missing wiki">TruncPoly</a>=79764919, 2&gt; <a class="missing wiki">InitRem</a>=-1, 2&gt; <a class="missing wiki">FinalXor</a>=-1, 2&gt; <a class="missing wiki">ReflectIn</a>=true, 2&gt; <a class="missing wiki">ReflectRem</a>=true 2&gt; ] 2&gt; ..\..\..\..\components\libs\checksum\source\Checksum.cpp(12) : see reference to class template instantiation 'boost::crc_optimal&lt;Bits,<a class="missing wiki">TruncPoly</a>,<a class="missing wiki">InitRem</a>,<a class="missing wiki">FinalXor</a>,<a class="missing wiki">ReflectIn</a>,<a class="missing wiki">ReflectRem</a>&gt;' being compiled 2&gt; with 2&gt; [ 2&gt; Bits=32, 2&gt; <a class="missing wiki">TruncPoly</a>=79764919, 2&gt; <a class="missing wiki">InitRem</a>=-1, 2&gt; <a class="missing wiki">FinalXor</a>=-1, 2&gt; <a class="missing wiki">ReflectIn</a>=true, 2&gt; <a class="missing wiki">ReflectRem</a>=true 2&gt; ] </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3194 Trac 1.4.3 jonw@… Fri, 14 Jan 2011 23:22:15 GMT <link>https://svn.boost.org/trac10/ticket/3194#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3194#comment:1</guid> <description> <p> For VS9 I did the following changes to crc.hpp (version 1_44_0) to remove the warnings from my code:<br /> </p> <pre class="wiki">line 377: BOOST_STATIC_CONSTANT( least, sig_bits = least( ~0 ) ); line 400: BOOST_STATIC_CONSTANT( least, sig_bits = least( ~0 ) ); line 578: { return static_cast&lt; unsigned char &gt;( x ^ rem ); } </pre><p> Could you please verify if this is appropriate? I know this would need to be tested for a great number of compilers/platforms. </p> </description> <category>Ticket</category> </item> </channel> </rss>