[ros-dev] [ros-diffs] [jgardou] 54462: [RTL] - explicitly truncate some values, so it doesn't count as an error for compiler/MSVC runtime checker

Jérôme Gardou jerome.gardou at laposte.net
Thu Nov 24 16:54:05 UTC 2011


Le 24/11/2011 09:04, Aleksey Bragin a écrit :
> On 24.11.2011 3:27, Jérôme Gardou wrote:
>> -            *ShortPtr = SWAPW(*ShortPtr) + LOWORD(Delta);
>> +            *ShortPtr = SWAPW(*ShortPtr) + LOWORD(Delta&  0xFFFF); 
> Maybe turn off this "feature" of MSVC checker then? Excuse me, but 
> it's literally a code pollution. Especially the above case, of firstly 
> ANDing with 0xFFFF, and *then* applying LOWORD (which would not change 
> anything at all).
>
> Or, as Timo said, maybe fix the macro? Move the cast elsewhere, so at 
> first you &, and only then cast?
>
>
> WBR,
> Aleskey.
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
This one is a mistake on my side.

And the macro is correct. The right thing to do is & and then casting, 
as you say.
BTW, this feature is of by default, you have to turn it on with the /RTC 
flag.



More information about the Ros-dev mailing list