Turning off BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS for MSVC++

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Turning off BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS for MSVC++

Boost - Users mailing list

Hi folks!

 

As part of a recent cleanup of some of our iostreams bits I removed a double-seek inside std::filebuf. (Previously, std::filebuf didn’t take advantage that we know ::fsetpos just accepts a 64 bit number position) Moreover, in previous releases of MSVC++, that still would have been correct; filebuf was getting to the same place in a very indirect way.

 

I know just casting std::fpos to a streamoff works to get the position going back to at least VS 2015, and it probably works a decade earlier than that (though I have not tested). Shame on us for adding a pretty name to std::fpos not depicted in the standard. Would you accept a patch to $\boost\iostreams\detail\config\fpos.hpp adding this guard before attempting to define BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS?

 

!(_MSVC_STL_VERSION >= 141)

 

I submitted a patch to do that here: https://github.com/boostorg/iostreams/pull/57

 

Thanks folks!

 

Billy O’Neal

Visual C++ Libraries


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Turning off BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS for MSVC++

Boost - Users mailing list
On 17/04/2018 0:43, Billy O'Neal (VC LIBS) via Boost-users wrote:

> Hi folks!
>
> As part of a recent cleanup of some of our iostreams bits I removed a
> double-seek inside std::filebuf. (Previously, std::filebuf didn’t take
> advantage that we know ::fsetpos just accepts a 64 bit number position)
> Moreover, in previous releases of MSVC++, that still would have been
> correct; filebuf was getting to the same place in a very indirect way.
>
> I know just casting std::fpos to a streamoff works to get the position
> going back to at least VS 2015, and it probably works a decade earlier
> than that (though I have not tested). Shame on us for adding a pretty
> name to std::fpos not depicted in the standard. Would you accept a patch
> to $\boost\iostreams\detail\config\fpos.hpp adding this guard before
> attempting to define BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS?
>
> !(_MSVC_STL_VERSION >= 141)
>
> I submitted a patch to do that here:
> https://github.com/boostorg/iostreams/pull/57

Shouldn't we check macro is #defined before using it?

Best,

Ion
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Turning off BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS for MSVC++

Boost - Users mailing list
On 17/04/2018 21:41, Ion Gaztañaga wrote:
> Shouldn't we check macro is #defined before using it?

Any standards-conforming preprocessor should not technically require
that (any undefined symbol is evaluated as 0).

Though not all are standards-conforming, and some might issue warning
diagnostics, so it's still probably a good idea to do so.

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users