On 07/02/2016 11:42 AM, Uwe Stöhr wrote:
> Since I am now able to compile master again with the latest MSVC 2015
> compiler, I get these new warnings:
>
> D:\LyXGit\Master\src\Changes.cpp(562): warning C4244: 'initializing':
> conversion from 'double' to 'int', possible loss of data
> [D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]
>
> D:\LyXGit\Master\src\Changes.cpp(562): warning C4244: 'initializing':
> conversion from 'double' to 'const int', possible loss of data
> [D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]
>
> D:\LyXGit\Master\src\Changes.cpp(592): warning C4244: 'argument':
> conversion from 'double' to 'int', possible loss of data
> [D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]
>
> D:\LyXGit\Master\src\Changes.cpp(592): warning C4244: 'argument':
> conversion from 'const double' to 'int', possible loss of data
> [D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]
>
> D:\LyXGit\Master\src\RowPainter.cpp(208): warning C4244: 'argument':
> conversion from 'double' to 'int', possible loss of data
> [D:\LyXGit\Master\compile-2015\src\LyX.vcxproj]

All harmless.

In future, you can fix these sorts of warnings easily.  For the first
one, just go to line 562 of Changes.cpp. What was there was:

int const y_bar = deleted() ? y - fm.maxAscent() / 3
        : y + 2 * pi.base.solidLineOffset() + pi.base.solidLineThickness();

The compiler is complaining that y - fm.maxAscent() / 3 is a double (as
is the other expression), and it is being assigned to an int. Here, we
clearly do want to do that, since the function to which we're about to
pass y_bar wants an int, too. So the solution is just:

int const y_bar = int(deleted() ? y - fm.maxAscent() / 3
        : y + 2 * pi.base.solidLineOffset() + pi.base.solidLineThickness());

I.e., we tell the compiler that we definitely do want to convert the
value to an int.

Richard

Reply via email to