Boost C++ Libraries: Ticket #990: spirit's file_iterator truncates file size value on Windows x64 (VC8.0express) https://svn.boost.org/trac10/ticket/990 <p> I have written a grammar to read in a file. I am using spirit's file_iterator class to enable the parse(...) function to read directly from the file and I get the following warning: </p> <pre class="wiki">1&gt; XXX\boost\boost_1_34_0\boost/spirit/iterator/impl/file_iterator.ipp(276) : warning C4244: 'return' : conversion from '__w64 int' to 'long', possible loss of data 1&gt; XXX\boost\boost_1_34_0\boost/spirit/iterator/impl/file_iterator.ipp(276) : while compiling class template member function 'long boost::spirit::fileiter_impl::mmap_file_iterator&lt;CharT&gt;::distance(const boost::spirit::fileiter_impl::mmap_file_iterator&lt;CharT&gt; &amp;) const' 1&gt; with 1&gt; [ 1&gt; CharT=char 1&gt; ] 1&gt; XXX\boost\boost_1_34_0\boost/spirit/iterator/file_iterator.hpp(118) : see reference to class template instantiation 'boost::spirit::fileiter_impl::mmap_file_iterator&lt;CharT&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; CharT=char 1&gt; ] 1&gt; XXX\boost\boost_1_34_0\boost/spirit/iterator/file_iterator.hpp(152) : see reference to class template instantiation 'boost::spirit::fileiter_impl::file_iter_generator&lt;CharT,BaseIteratorT&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; CharT=char, 1&gt; BaseIteratorT=boost::spirit::fileiter_impl::mmap_file_iterator&lt;char&gt; 1&gt; ] 1&gt; .\myfile.cpp(121) : see reference to class template instantiation 'boost::spirit::file_iterator&lt;&gt;' being compiled </pre><p> This would be a problem for me if my file's were large, but they are not. Essentially in the file_iterator.ipp function the <br /> </p> <blockquote> <p> <em>long distance(const mmap_file_iterator&amp; iter) const</em><br /> </p> </blockquote> <p> is wrong as the difference between pointers on a 64bit windows computer is not a long. I think this needs to change to:<br /> </p> <blockquote> <p> <em>ptrdiff_t distance(const mmap_file_iterator&amp; iter) const</em><br /> </p> </blockquote> <p> I have tried this in my copy of the file, but the warning moves to the files/classes that use the function. I am also not sure about the other considerations for this function's return type, so I haven't proposed a patch. </p> <p> I am compiling on Windows XP Pro x64, using MSVC++ 8.0 express edition (with SP1) on Xeon CPUs. I'm pretty sure the problem was also present without SP1. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/990 Trac 1.4.3 Hartmut Kaiser Tue, 05 Jun 2007 16:16:24 GMT status changed; owner set https://svn.boost.org/trac10/ticket/990#comment:1 https://svn.boost.org/trac10/ticket/990#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Hartmut Kaiser</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Hartmut Kaiser Tue, 05 Jun 2007 16:45:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/990#comment:2 https://svn.boost.org/trac10/ticket/990#comment:2 <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> <p> Fixed in Boost CVS::HEAD. </p> Ticket Thomas Witt Tue, 05 Jun 2007 17:02:53 GMT status changed; milestone set; resolution deleted https://svn.boost.org/trac10/ticket/990#comment:3 https://svn.boost.org/trac10/ticket/990#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>milestone</strong> → <span class="trac-field-new">Boost 1.34.1</span> </li> </ul> <p> Reopened for consideration in 1.34.1. </p> Ticket Hartmut Kaiser Tue, 05 Jun 2007 18:45:10 GMT attachment set https://svn.boost.org/trac10/ticket/990 https://svn.boost.org/trac10/ticket/990 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">file_iterator.hpp.patch</span> </li> </ul> <p> Patch for boost/spirit/iterator/file_iterator.hpp </p> Ticket Hartmut Kaiser Tue, 05 Jun 2007 18:45:55 GMT attachment set https://svn.boost.org/trac10/ticket/990 https://svn.boost.org/trac10/ticket/990 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">file_iterator.ipp.patch</span> </li> </ul> <p> patch for boost/spirit/iterator/impl/file_iterator.ipp </p> Ticket Thomas Witt Thu, 07 Jun 2007 17:57:09 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/990#comment:4 https://svn.boost.org/trac10/ticket/990#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Patch applied to RC_1_34_0. </p> Ticket