Boost C++ Libraries: Ticket #1229: [GCC] compiler warning: comparison between signed and unsigned integer expressions https://svn.boost.org/trac10/ticket/1229 <p> I've attached the warning generated during compilation of the Serialization library. </p> <pre class="wiki">gcc.compile.c++ /usr/local/lib/boost/bin.v2/libs/serialization/build/gcc-4.1.2/debug/link-static/optimization-speed/threading-multi/binary_iarchive.o /usr/local/lib/boost/boost/archive/basic_binary_iprimitive.hpp: In member function void boost::archive::basic_binary_iprimitive&lt;Archive, Elem, Tr&gt;::load_binary(void*, size_t) [with Archive = boost::archive::naked_binary_iarchive, Elem = char, Tr = std::char_traits&lt;char&gt;]: /usr/local/lib/boost/libs/serialization/src/binary_iarchive.cpp:24: instantiated from here /usr/local/lib/boost/boost/archive/basic_binary_iprimitive.hpp:163: warning: comparison between signed and unsigned integer expressions /usr/local/lib/boost/boost/archive/basic_binary_iprimitive.hpp: In member function void boost::archive::basic_binary_iprimitive&lt;Archive, Elem, Tr&gt;::load_binary(void*, size_t) [with Archive = boost::archive::binary_iarchive, Elem = char, Tr = std::char_traits&lt;char&gt;]: /usr/local/lib/boost/libs/serialization/src/binary_iarchive.cpp:38: instantiated from here /usr/local/lib/boost/boost/archive/basic_binary_iprimitive.hpp:163: warning: comparison between signed and unsigned integer expressions </pre><p> GCC Compiler version 4.1.2 . </p> <p> I suspect the problem has something to do with the GNU GCC's definition of 'streamsize' as: </p> <pre class="wiki"> /// Integral type for I/O operation counts and buffer sizes. typedef ptrdiff_t streamsize; // Signed integral type </pre><p> -- from bits/postypes.h </p> <p> The warning is caused by the following code: </p> <pre class="wiki"> std::streamsize s = count / sizeof(Elem); std::streamsize scount = m_sb.sgetn( static_cast&lt;Elem *&gt;(address), s ); if(scount != static_cast&lt;std::size_t&gt;(s)) boost::throw_exception( archive_exception(archive_exception::stream_error) ); </pre><p> Changing 'std::size_t' into 'std::streamsize' seems to resolve the problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1229 Trac 1.4.3 Robert Ramey Sun, 09 Sep 2007 18:08:33 GMT status, severity, milestone changed; resolution set https://svn.boost.org/trac10/ticket/1229#comment:1 https://svn.boost.org/trac10/ticket/1229#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">fixed</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Cosmetic</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.35.0</span> </li> </ul> <p> fixed in next release </p> Ticket