size_t + ptrdiff_t

Stewart Gordon smjg_1998 at
Sun Feb 19 07:09:05 PST 2012

On 19/02/2012 14:59, Manu wrote:
> Okay, so it came up a couple of times, but the questions is, what are we going to do about it?
> size_t and ptrdiff_t are incomplete, and represent non-complimentary signed/unsigned
> halves of the requirement.
> There are TWO types needed, register size, and pointer size. Currently, these are assumed
> to be the same, which is a false assumption.

The whole point of size_t and ptrdiff_t is that they are integer types that span the 
address space.  So that the size of an allocated block of memory (and consequently, the 
number of elements in an array) is bound to fit in a size_t, and the displacement between 
two memory locations is bound to fit in a ptrdiff_t.

What would this "register size" type you are proposing be for, exactly?

> There is also the problem that there is lots of code written using the incorrect types.

Like what?

More information about the Digitalmars-d mailing list