larmbr zhan wrote:
On Sun, Mar 10, 2013 at 5:48 AM, Andrew Talbot andrew.talbot@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,