Subject: Re: PTRTOINT64() / INT64TOPTR()
To: Jason Thorpe <>
From: Andrew Brown <>
List: tech-kern
Date: 02/18/2004 21:33:40
>> I'm not sure why we use uint64_t. It could predate uintptr_t. What does
>> cvs blame say?
>We use uint64_t there because it's the largest pointer size of any 
>platform we support.  This means that a 32-bit sysctl running on a 
>sparc64 system (for example) will work properly.

no no no.  you misunderstand me.

i know we're using u_int64_t because of the 32/64 interoperabilization
that it gets us.  i also get that casting the pointer to a uintptr_t
will make it into an unsigned integer that won't get sign extended
upon being cast into 64 bits.

what i was mildly confused by was the need for, and definition of, the
uintptr_t type.

why do we need it?  after all, we already have size_t and unsigned

how does it differ from a size_t?  aren't they the same bit length and

why does it differ from a size_t?  size_t is sometimes an unsigned int
and sometimes an unsigned long and sometimes an unsigned long int, and
uintptr_t is more often an unsigned long (or unsigned long int), but
is unsigned int in a couple of places.  why isn't it just an unsigned
long all over the place?

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."