bearophile Wrote:

> In my programs I use use unsigned integers and unsigned longs as:
> - bitfields, a single size_t, for example to represent a small set of items.
> - bitarrays, in an array of size_t, to represent a larger set, to have array 
> of bit flags, etc.
> - to pack small variables into a uint, size_t, etc, for example use the first 
> 5 bits to represent a, the following 2 bits to represent b, etc. In such 
> situation I have never pack such variables into a signed int.

I think, signed ints can hold bits as gracefully as unsigned ones.

> - when I need very large integer values, but this has to be done with care, 
> because they can't be converted back to ints.

I don't think that large integers know or respect computers-specific integers 
limits. They just get larger and larger.

> - Probably there are few other situations, for example I think I've used an 
> ushort once, but not many of them.

legacy technologies tend to use unsigneds intensively and people got used to 
unsigned chars (for comparison and character maps).

Reply via email to