advapi32: Fix comparisons of unsigned expressions with zero

Andrew Talbot Andrew.Talbot at
Fri Dec 8 11:27:56 CST 2006

Mike McCormack wrote:

> Andrew Talbot wrote:
>> -    if( n < 0 )
>> +    if( (LONG)n < 0 )
> Why not change the type of n to LONG rather than using a cast?
> Mike

Hi Mike,

Long answer (no pun intended):

There were two ways to jump: I could either have, as you say, made n long,
so it could accept negative values, or kept it unsigned and used a cast. I
thought about K & R and character-reading functions taking intS, because of
EOF. But I decided that that was because EOF was a 'legitimate' value;
whereas, in this case, n was inherently a positive commodity and would go
negative only in the case of an error condition.

Short answer:

OK, I'll resubmit using LONGs. Thanks for taking an interest.

-- Andy.

More information about the wine-devel mailing list