Boost should not be saying "_FPOSOFF"
Hello, Boost folks. :)
I tried to remove this undocumented internal macro from our STL because we used it in only one place, but this broke Boost:
#define _FPOSOFF(fp) ((long long)(fp))
...patience...
...found 722 targets...
...updating 18 targets...
common.mkdir build\boost\bin.v2\libs
common.mkdir build\boost\bin.v2\libs\iostreams
common.mkdir build\boost\bin.v2\libs\iostreams\build
common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99
common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug
common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static
common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi
compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj
file_descriptor.cpp
d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found
libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data
libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj...
compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj
mapped_file.cpp
d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found
libs\iostreams\src\mapped_file.cpp(59): warning C4244: 'return': conversion from 'const boost::iostreams::stream_offset' to '::size_t', possible loss of data
libs\iostreams\src\mapped_file.cpp(325): warning C4244: 'argument': conversion from 'boost::iostreams::stream_offset' to 'SIZE_T', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj...
...skipped
On September 2, 2016 2:06:17 PM EDT, "Billy O'Neal (VC LIBS)"
I tried to remove this undocumented internal macro from our STL because we used it in only one place, but this broke Boost:
#define _FPOSOFF(fp) ((long long)(fp))
[snip]
compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj file_descriptor.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj... compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj mapped_file.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found
Thanks for the report. Boost.IOStreams has no maintainer. The Community Maintenance Team might be handling it, though. Can you tell us what change can be made to the code to effect what had been gained by using that macro? -- Rob (Sent from my portable computation device.)
[Rob Stewart]
Can you tell us what change can be made to the code to effect what had been gained by using that macro?
It's unconditionally: #define _FPOSOFF(fp) ((long long)(fp)) So you should be able to replace it with a static_cast, or eliminate it entirely. STL
On 06 September 2016 19:24, Stephan T. Lavavej wrote:
[Rob Stewart]
Can you tell us what change can be made to the code to effect what had been gained by using that macro?
It's unconditionally:
#define _FPOSOFF(fp) ((long long)(fp))
So you should be able to replace it with a static_cast, or eliminate it entirely.
STL
These days I'm sure that's true, but formerly don't I remember on 32-bit platforms it could be something like this? typedef struct fpos_t { unsigned int lopart; int hipart; } fpos_t; #define _FPOSOFF(fp) ((long)(fp).lopart) How long in the tooth am I? Gareth ************************************************************************ The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only. This email and any response may be monitored by Sony to be in compliance with Sony's global policies and standards
[STL]
It's unconditionally: #define _FPOSOFF(fp) ((long long)(fp))
[Gareth Sylvester-Bradley]
These days I'm sure that's true, but formerly don't I remember on 32-bit platforms it could be something like this? typedef struct fpos_t { unsigned int lopart; int hipart; } fpos_t; #define _FPOSOFF(fp) ((long)(fp).lopart) How long in the tooth am I?
I've never seen that. VS 2012+ have the long long cast. In VS 2010 (and going back to 2005, IIRC), it was: #define _FPOSOFF(fp) ((long)(fp)) which was hostile to large files, which was why we changed it. STL
On 6 September 2016 at 19:24, Stephan T. Lavavej
[Rob Stewart]
Can you tell us what change can be made to the code to effect what had been gained by using that macro?
It's unconditionally:
#define _FPOSOFF(fp) ((long long)(fp))
So you should be able to replace it with a static_cast, or eliminate it entirely.
That might break older versions, or other uses of Dinkumware. I would try changing this configuration file so that it only applies to old versions: https://github.com/boostorg/iostreams/blob/develop/include/boost/iostreams/d... I don't have access to Visual C++ so I can't do it myself. If anyone wants to, all the relevant code is here: https://github.com/boostorg/iostreams/blob/develop/include/boost/iostreams/p...
On 9/6/2016 2:49 PM, Daniel James wrote:
On 6 September 2016 at 19:24, Stephan T. Lavavej
wrote: [Rob Stewart]
Can you tell us what change can be made to the code to effect what had been gained by using that macro?
It's unconditionally:
#define _FPOSOFF(fp) ((long long)(fp))
So you should be able to replace it with a static_cast, or eliminate it entirely.
That might break older versions, or other uses of Dinkumware. I would try changing this configuration file so that it only applies to old versions:
https://github.com/boostorg/iostreams/blob/develop/include/boost/iostreams/d...
I don't have access to Visual C++ so I can't do it myself. If anyone wants to, all the relevant code is here:
https://github.com/boostorg/iostreams/blob/develop/include/boost/iostreams/p...
The best way for iostreams seems to be to create and use its own macro, equivalent to _FPOSOFF(fp), for older versions of VC++ but hardcodes as '((long long)(fp))' for VC++14 on up. This would allow Microsoft to remove it in future versions of VC++ without affecting iostreams. I assume Microsoft will not be retroactively removing for older versions of VC++ prior to VC++14, even if it is an implementation detail. If iostreams is not currently under CMT, if you add it as a CMT library I will make the appropriate change and test it out. This won't get in 1.62 but should be in the next release after that.
On 6 September 2016 at 21:32, Edward Diener
The best way for iostreams seems to be to create and use its own macro, equivalent to _FPOSOFF(fp), for older versions of VC++ but hardcodes as '((long long)(fp))' for VC++14 on up. This would allow Microsoft to remove it in future versions of VC++ without affecting iostreams.
IMO it would be better if all new compilers/libraries used the same implementation, and the special Dinkumware implementation used only for older compilers/librarires. Although that might not be possible, and there seem to be some functions that are only defined for Dinkumware, so they might need to be supported. Anyway, it's up to whoever does this.
On 9/2/2016 2:06 PM, Billy O'Neal (VC LIBS) wrote:
Hello, Boost folks. :)
I tried to remove this undocumented internal macro from our STL because we used it in only one place, but this broke Boost:
#define _FPOSOFF(fp) ((long long)(fp))
...patience... ...found 722 targets... ...updating 18 targets... common.mkdir build\boost\bin.v2\libs common.mkdir build\boost\bin.v2\libs\iostreams common.mkdir build\boost\bin.v2\libs\iostreams\build common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99 common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj file_descriptor.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj... compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj mapped_file.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\mapped_file.cpp(59): warning C4244: 'return': conversion from 'const boost::iostreams::stream_offset' to '::size_t', possible loss of data libs\iostreams\src\mapped_file.cpp(325): warning C4244: 'argument': conversion from 'boost::iostreams::stream_offset' to 'SIZE_T', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj... ...skipped
libboost_iostreams-vc-mt-gd-1_60.lib for lack of file_descriptor.obj... ...skipped libboost_iostreams-vc-mt-gd-1_60.lib for lack of libboost_iostreams-vc-mt-gd-1_60.lib... common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj file_descriptor.cpp .\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj... compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj mapped_file.cpp .\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\mapped_file.cpp(59): warning C4244: 'return': conversion from 'const boost::iostreams::stream_offset' to '::size_t', possible loss of data libs\iostreams\src\mapped_file.cpp(325): warning C4244: 'argument': conversion from 'boost::iostreams::stream_offset' to 'SIZE_T', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj... ...skipped
libboost_iostreams-vc-mt-1_60.lib for lack of file_descriptor.obj... ...skipped libboost_iostreams-vc-mt-1_60.lib for lack of libboost_iostreams-vc-mt-1_60.lib... ...failed updating 4 targets... ...skipped 4 targets... ...updated 10 targets... failed
I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up. This won't get in the upcoming release but it should get in the subsequent Boost release.
Billy3
Thanks :D Billy3 From: Edward Dienermailto:eldiener@tropicsoft.com Sent: Monday, September 19, 2016 5:19 AM To: boost@lists.boost.orgmailto:boost@lists.boost.org Subject: Re: [boost] Boost should not be saying "_FPOSOFF" On 9/2/2016 2:06 PM, Billy O'Neal (VC LIBS) wrote:
Hello, Boost folks. :)
I tried to remove this undocumented internal macro from our STL because we used it in only one place, but this broke Boost:
#define _FPOSOFF(fp) ((long long)(fp))
...patience... ...found 722 targets... ...updating 18 targets... common.mkdir build\boost\bin.v2\libs common.mkdir build\boost\bin.v2\libs\iostreams common.mkdir build\boost\bin.v2\libs\iostreams\build common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99 common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj file_descriptor.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\file_descriptor.obj... compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj mapped_file.cpp d:\src\vc\wcfb01\qa\vc\FE\3rdpartycomp\boost_1_60_0\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\mapped_file.cpp(59): warning C4244: 'return': conversion from 'const boost::iostreams::stream_offset' to '::size_t', possible loss of data libs\iostreams\src\mapped_file.cpp(325): warning C4244: 'argument': conversion from 'boost::iostreams::stream_offset' to 'SIZE_T', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\debug\link-static\threading-multi\mapped_file.obj... ...skipped
libboost_iostreams-vc-mt-gd-1_60.lib for lack of file_descriptor.obj... ...skipped libboost_iostreams-vc-mt-gd-1_60.lib for lack of libboost_iostreams-vc-mt-gd-1_60.lib... common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static common.mkdir build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj file_descriptor.cpp .\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\file_descriptor.cpp(265): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data libs\iostreams\src\file_descriptor.cpp(289): warning C4244: 'argument': conversion from 'std::streamsize' to 'DWORD', possible loss of data cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\file_descriptor.obj... compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj mapped_file.cpp .\boost/iostreams/positioning.hpp(107): error C3861: '_FPOSOFF': identifier not found libs\iostreams\src\mapped_file.cpp(59): warning C4244: 'return': conversion from 'const boost::iostreams::stream_offset' to '::size_t', possible loss of data libs\iostreams\src\mapped_file.cpp(325): warning C4244: 'argument': conversion from 'boost::iostreams::stream_offset' to 'SIZE_T', possible loss of data
cl /Zm800 -nologo @"build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj.rsp"
...failed compile-c-c++ build\boost\bin.v2\libs\iostreams\build\msvc-99\release\link-static\threading-multi\mapped_file.obj... ...skipped
libboost_iostreams-vc-mt-1_60.lib for lack of file_descriptor.obj... ...skipped libboost_iostreams-vc-mt-1_60.lib for lack of libboost_iostreams-vc-mt-1_60.lib... ...failed updating 4 targets... ...skipped 4 targets... ...updated 10 targets... failed
I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up. This won't get in the upcoming release but it should get in the subsequent Boost release.
Billy3
_______________________________________________ Unsubscribe & other changes: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.boost.org%2fmailman%2flistinfo.cgi%2fboost&data=02%7c01%7cbion%40microsoft.com%7c9a62884203044a54548708d3e0873faf%7c72f988bf86f141af91ab2d7cd011db47%7c1%7c0%7c636098843906180217&sdata=aGAHNfX6BMrM2WyPwb9fCjMLoAjfCv9Ub5aAWiCaM4c%3d
On Mon, Sep 19, 2016 at 7:18 AM, Edward Diener
I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up.
That seems like a fragile fix to me. How do you know which version of VC is not going to have that def? Wouldn't it be better to use _FPOSOFF if it's defined, and the cast otherwise? That way whenever the macro goes away it will work, regardless of the specific version when that happens. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
On 9/19/2016 1:32 PM, Rene Rivera wrote:
On Mon, Sep 19, 2016 at 7:18 AM, Edward Diener
wrote: I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up.
That seems like a fragile fix to me. How do you know which version of VC is not going to have that def? Wouldn't it be better to use _FPOSOFF if it's defined, and the cast otherwise? That way whenever the macro goes away it will work, regardless of the specific version when that happens.
I understand what you are saying but _FPOSOFF is "undocumented" in the sense that it should not be relied on. Since I was told in this thread that for VC++14 on up Microsoft plans to "remove" it would it not simply be better not to rely on it for those releases of VC++ ? I could of course easily enough test for it and, if it exists, still use _FPOSOFF, which is what you are suggesting.
For the moment (as in “what is going to ship with VS “15””) we have done this: // TRANSITION: Boost nonconformingly uses this macro #define _FPOSOFF(fp) ((long long)(fp)) Because even if Boost fixes this immediately we don’t want break all the existing Boost instances out there. Will nuke outright next time we break bincompat; sometime after VS “15”. Billy3 From: Edward Dienermailto:eldiener@tropicsoft.com Sent: Monday, September 19, 2016 2:27 PM To: boost@lists.boost.orgmailto:boost@lists.boost.org Subject: Re: [boost] Boost should not be saying "_FPOSOFF" On 9/19/2016 1:32 PM, Rene Rivera wrote:
On Mon, Sep 19, 2016 at 7:18 AM, Edward Diener
wrote: I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up.
That seems like a fragile fix to me. How do you know which version of VC is not going to have that def? Wouldn't it be better to use _FPOSOFF if it's defined, and the cast otherwise? That way whenever the macro goes away it will work, regardless of the specific version when that happens.
I understand what you are saying but _FPOSOFF is "undocumented" in the sense that it should not be relied on. Since I was told in this thread that for VC++14 on up Microsoft plans to "remove" it would it not simply be better not to rely on it for those releases of VC++ ? I could of course easily enough test for it and, if it exists, still use _FPOSOFF, which is what you are suggesting. _______________________________________________ Unsubscribe & other changes: https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.boost.org%2fmailman%2flistinfo.cgi%2fboost&data=02%7c01%7cbion%40microsoft.com%7c459d3f195ad04362b8eb08d3e0d3c071%7c72f988bf86f141af91ab2d7cd011db47%7c1%7c0%7c636099172473744664&sdata=im4hQFduonfHAXuSyjiO1J9yTIBEx1T%2fOS5UpasByNo%3d
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 -- View this message in context: http://boost.2283326.n4.nabble.com/Boost-should-not-be-saying-FPOSOFF-tp4687... Sent from the Boost - Dev mailing list archive at Nabble.com.
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"
OK, in more detail: the actual offset in a std::streampos is "_Fpos + _Myoff". std::streampos::seekpos returns "_Fpos" std::streamoff(std::streampos) returns "_Myoff + _FPOSOFF(_Fpos)" to get to the desired "_Fpos + _Myoff" we run: std::streampos::seekpos() + std::streamoff(std::streampos) - _FPOSOFF( std::streampos::seekpos() ) which is equivalent to: _Fpos + std::streamoff(std::streampos) - _FPOSOFF( _Fpos ) which is equivalent to: _Fpos + _Myoff + _FPOSOFF(_Fpos) - _FPOSOFF( _Fpos ) the two _FPOSOFF(_Fpos) cancel out to leave the desired: _Fpos + _Myoff -- View this message in context: http://boost.2283326.n4.nabble.com/Boost-should-not-be-saying-FPOSOFF-tp4687... Sent from the Boost - Dev mailing list archive at Nabble.com.
On 9/26/2016 4:45 PM, alanbirtles2 wrote:
OK, in more detail: the actual offset in a std::streampos is "_Fpos + _Myoff". std::streampos::seekpos returns "_Fpos" std::streamoff(std::streampos) returns "_Myoff + _FPOSOFF(_Fpos)" to get to the desired "_Fpos + _Myoff" we run: std::streampos::seekpos() + std::streamoff(std::streampos) - _FPOSOFF( std::streampos::seekpos() ) which is equivalent to: _Fpos + std::streamoff(std::streampos) - _FPOSOFF( _Fpos ) which is equivalent to: _Fpos + _Myoff + _FPOSOFF(_Fpos) - _FPOSOFF( _Fpos ) the two _FPOSOFF(_Fpos) cancel out to leave the desired: _Fpos + _Myoff
This explanation is clearer to me than your previous shorthand. Thanks !
On 9/19/2016 1:32 PM, Rene Rivera wrote:
On Mon, Sep 19, 2016 at 7:18 AM, Edward Diener
wrote: I have pushed a fix for this on the 'develop' branch of iostreams. In the fix basically iostreams uses _FPOSOFF for versions of VC++ prior to VC++14 but uses '((long long)(fp))' for VC++14 on up.
That seems like a fragile fix to me. How do you know which version of VC is not going to have that def? Wouldn't it be better to use _FPOSOFF if it's defined, and the cast otherwise? That way whenever the macro goes away it will work, regardless of the specific version when that happens.
I have changed the fix based on your objection above, since I think you are right.
participants (8)
-
alanbirtles2
-
Billy O'Neal (VC LIBS)
-
Daniel James
-
Edward Diener
-
Rene Rivera
-
Rob Stewart
-
Stephan T. Lavavej
-
Sylvester-Bradley, Gareth