Richard Heck wrote:

> On 01/10/2015 08:20 PM, Uwe Stöhr wrote:
>> Hello JMarc,
>>
>> after your merge I get these 2 compilation warnings:
>>
>>   ..\..\src\RowPainter.cpp(448): warning C4244: 'Argument': conversion
>> of 'float' to 'int', possible dataloss
>>   ..\..\src\RowPainter.cpp(450): warning C4244: 'Initialisation':
>> conversion of 'float' to 'const int'
>>
>> (I am wondering that only MSVC outputs these warnings.)

Because they are on by default in MSVC and off by default in gcc. You can 
get similar ones with gcc by calling it with -Wconversion (but that outputs 
many more).

> A lot of compilers will see these, but they are mostly harmless. These
> are just implicit conversions of floats to ints, which will lead to
> rounding errors. They should be fixed, so only "real" warnings appear,
> but they won't cause problems.

I have had cases where those warnings showed a real problem, and in my 
experience it is worth it to have a look at them. In the cases where they 
are harmless it is easy to state with a

static_cast<int>(xxx)

that the author of that code is aware that there is a possiblly lossy 
conversion, but that the loss is no problem.


Georg

Reply via email to