size_t + ptrdiff_t
timon.gehr at gmx.ch
Sun Feb 19 10:07:38 PST 2012
On 02/19/2012 03:59 PM, 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.
> I propose size_t + ssize_t should both exist, and represent the native
> integer size. Also something like ptr_t, and ptrdiff_t should also
> exist, and represent the size of the pointer.
> Personally, I don't like the _t notation at all. It doesn't fit the rest
> of the D types, but it's established, so I don't expect it can change.
> But we do need the 2 missing types.
> There is also the problem that there is lots of code written using the
> incorrect types. Some time needs to be taken to correct phobos too I guess.
Currently, size_t is defined to be what you call ptr_t, ptrdiff_t is
present, and what you call size_t/ssize_t does not exist. Under which
circumstances is it important to have a distinct type that denotes the
register size? What kind of code requires such a type? It is unportable.
More information about the Digitalmars-d