[Boost-bugs] [Boost C++ Libraries] #990: spirit's file_iterator truncates file size value on Windows x64 (VC8.0express)

Subject: [Boost-bugs] [Boost C++ Libraries] #990: spirit's file_iterator truncates file size value on Windows x64 (VC8.0express)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-05-24 10:58:16


#990: spirit's file_iterator truncates file size value on Windows x64
(VC8.0express)
---------------------------------------------------+------------------------
 Reporter: peter.myerscough-jackopson_at_[hidden] | Type: Bugs
   Status: new | Milestone:
Component: spirit | Version: release 1.34.0
 Severity: Problem | Keywords: file_iterator spirit x64 windows 64bit
---------------------------------------------------+------------------------
 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:

 {{{
 1>
 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>
 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<CharT>::distance(const
 boost::spirit::fileiter_impl::mmap_file_iterator<CharT> &) const'
 1> with
 1> [
 1> CharT=char
 1> ]
 1>
 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<CharT>' being compiled
 1> with
 1> [
 1> CharT=char
 1> ]
 1>
 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<CharT,BaseIteratorT>'
 being compiled
 1> with
 1> [
 1> CharT=char,
 1>
 BaseIteratorT=boost::spirit::fileiter_impl::mmap_file_iterator<char>
 1> ]
 1> .\myfile.cpp(121) : see reference to class template
 instantiation 'boost::spirit::file_iterator<>' being compiled
 }}}

 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]]
  ''long distance(const mmap_file_iterator& iter) const''[[BR]]
 is wrong as the difference between pointers on a 64bit windows computer is
 not a long. I think this needs to change to:[[BR]]
  ''ptrdiff_t distance(const mmap_file_iterator& iter) const''[[BR]]
 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.

 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.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/990>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:55 UTC