[locale] Loss of precision (C4244) warnings in MSVC 64-bit build

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

[locale] Loss of precision (C4244) warnings in MSVC 64-bit build

Boost - Dev mailing list
Building with MSVC compilers for 64-bit results in several C4244 warnings
in api.hpp, due to passing the difference of two pointers (ptrdiff_t) to
Win APIs expecting an int.

Patch here:

<https://github.com/boostorg/locale/issues/42>

Using this command with the recent 1.71.0 beta:

call .\bootstrap.bat --without-python

.\b2 --without-python toolset=msvc-14.2,msvc-14.0,msvc-12.0,msvc-10.0
runtime-link=shared,static address-model=32,64


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [locale] Loss of precision (C4244) warnings in MSVC 64-bit build

Boost - Dev mailing list
On 24/07/2019 17:08, Kenneth Porter wrote:
> Building with MSVC compilers for 64-bit results in several C4244
> warnings in api.hpp, due to passing the difference of two pointers
> (ptrdiff_t) to Win APIs expecting an int.
>
> Patch here:
>
> <https://github.com/boostorg/locale/issues/42>

You should probably make that into a pull request, rather than an issue
with a patch file attached.

Also, static_cast is probably preferred over C-style casts.

Ideally you should probably BOOST_ASSERT that the result of the
subtraction fits into an int, as well; just to be safe.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost