On 9/26/2016 7:02 AM, alanbirtles2 wrote:
some context to the use of _FPOSOFF in boost might be useful. up to and including VS 2015 std::streamoff(std::streampos()) returned _Myoff + _FPOSOFF(_Fpos). there is no other way to retrieve the value of _Myoff from std::streampos. until VS 2012 _FPOSOFF was a cast to long. therefore the only way to safely get the stream offset from a std::streampos was to do: pos.seekpos + std::streamoff( pos ) - _FPOSOFF( pos.seekpos ) == _Fpos + _Myoff + _FPOSOFF(_Fpos) - _FPOSOFF( _Fpos ) == _Fpos + _Myoff after VS 2012 the _FPOSOFF macro is a cast to long long so calling std::streamoff(std::streampos()) returns the correct value and the above workaround is no longer necessary
I appreciate the historical explanation but it is confusing to me. Especially: "pos.seekpos + std::streamoff( pos ) - _FPOSOFF( pos.seekpos ) == _Fpos +_Myoff + _FPOSOFF(_Fpos) - _FPOSOFF( _Fpos ) == _Fpos + _Myoff"