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

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

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:
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.
participants (2)
-
Gavin Lambert
-
Kenneth Porter