size_t vs uintptr_t

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 14 23:31:11 PDT 2016


On 2016-06-14 23:59, Walter Bright wrote:
> I recently remembered something I'd half-forgotten. A size_t is not
> guaranteed to be the same size as a pointer. A uintptr_t is.
>
> size_t and uintptr_t are the same for all platforms that D currently
> supports. But this may not always hold true, and besides, it is better
> self-documenting when using uintptr_t for "holds a pointer" as opposed
> to size_t as "holds an offset to a pointer".

> Ok, I admit these are not likely to emerge. But I'd like our code to be
> pedantically, nitpickingly correct, as well as self-documenting.

I'd like that too, but as you said it's not an issue on any supported 
platforms. Therefore I think we have much more important stuff to do 
than worry about than fixing this.

As Andrei has said:

"Let's keep the eyes on the ball".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list