msvcp60: Avoid signed-unsigned integer comparisons

Andrew Talbot andrew.talbot at talbotville.com
Mon Mar 11 14:57:45 CDT 2013


larmbr zhan wrote:

> On Sun, Mar 10, 2013 at 5:48 AM, Andrew Talbot
> <andrew.talbot at talbotville.com> wrote:
>> msvcp60: Avoid signed-unsigned integer comparisons.
> 
> 
> Hi, Andrew Talbot.
> 
> I find that you are working on these "Avoid signed-unsigned integer
> comparisons" things recently.
> 
> I DO agree on that using   _ unsigned int _ instead of  _ int _(which
> implies _ signed int _).
> But I think using  size_t maybe more standard-compliant, more
> efficient, and less bug-prone, .
> 
> [...]

Hi, Zhan JIanyu,

I would say that size_t (and ptrdiff_t) are most suitable for "memsizes"
that are open-ended and could potentially have huge values. However, where
it is clear that gigabytes will never be involved nor billions of items,
there is nothing more efficient than an int (signed or unsigned), since it
has the same width as the processor. For real-world quantities, such as
"width" and "height", I would prefer to use signed intS where possible, even
for non-negative commodities. I would prefer unsigned intS for bit arrays.

Regard,

-- 
Andy.





More information about the wine-devel mailing list