size_t vs uintptr_t

Observer via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 18 11:49:58 PDT 2016


On Friday, 17 June 2016 at 15:50:41 UTC, Guillaume Boucher wrote:
> I was referring to this diff in the pull linked request:
>
> -private size_t _alignUp(size_t alignment)(size_t n)
> +private uintptr_t _alignUp(uintptr_t alignment)(uintptr_t n)
>
> size_t is the correct type.  There is no reason to change it.

I dislike the conceptually privileged status of "uint" in Walter's
proposal.  size_t is generic; uint is not.  I like the idea in C++
of the ptrdiff_t type being generic across pointer types.  If we
want to have the code be conceptually cleaner, I think a type such
as voidptr_t, which is more obviously intended to represent an
arbitrary pointer, would be a better choice.


More information about the Digitalmars-d mailing list