Boost C++ Libraries: Ticket #4208: Boost::crc fails if Visual C++'s "/RTCc Convert to smaller type checks" is enabled https://svn.boost.org/trac10/ticket/4208 <p> Boost::crc fails if Visual C++'s "/RTCc Convert to smaller type checks" is enabled </p> <p> I would suggest to change crc_helper::index() from </p> <pre class="wiki">static unsigned char index( value_type rem, unsigned char x ) { return x ^ rem; } </pre><p> to </p> <pre class="wiki">static unsigned char index( value_type rem, unsigned char x ) { return x ^ (rem &amp; 0xFF); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4208 Trac 1.4.3 Steven Watanabe Wed, 12 May 2010 13:08:40 GMT <link>https://svn.boost.org/trac10/ticket/4208#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4208#comment:1</guid> <description> <pre class="wiki">x ^ static_cast&lt;unsigned char&gt;(rem) </pre><p> would be slightly better. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Fri, 18 Jun 2010 14:31:39 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4208#comment:2 https://svn.boost.org/trac10/ticket/4208#comment:2 <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> /RTCc yields non-conformant behavior. The behavior of the following program is well-defined (technically implementation defined since sizeof(short) is implementation defined) according to the C++ standard. In most implementations it will print 1. </p> <pre class="wiki">#include &lt;iostream&gt; int main() { unsigned int i = 65537; unsigned short s = static_cast&lt;unsigned short&gt;(i); std::cout &lt;&lt; s &lt;&lt; std::endl; } </pre> Ticket