Subject: Re: PTRTOINT64() / INT64TOPTR()
To: Andrew Brown <atatat@atatdot.net>
From: Klaus Klein <kleink@reziprozitaet.de>
List: tech-kern
Date: 02/18/2004 16:00:22
On Wednesday 18 February 2004 15:32, Andrew Brown wrote:
> On Wed, Feb 18, 2004 at 01:11:16PM +0100, Klaus Klein wrote:
> >On Tuesday 17 February 2004 23:31, Daniel Carosone wrote:
> >> On Wed, Feb 18, 2004 at 09:17:58AM +1100, Simon Burge wrote:
> >> > I wonder if <sys/sysctl.h> is the right place - the macro isn't
> >> > sysctl-specific.  That said, I'm not sure where else.  <sys/param.h>
> >> > seems like overkill.
> >>
> >> types.h or one of the inttypes variants under it?
> >
> >I'd prefer having it not appear in the standard headers.  First,
> >there's the namespace issue.   Second, C99 doesn't really say
> >that you can convert between pointers and uint64_t (note that
> >the current implementation is using u_int64_t, and PTRTOUINT64()
> >would be a slightly less confusing name); that's why there's
> >uintptr_t, after all.
>
> well...sys/sysctl.h isn't a standard header.

Just to be clear: I don't particularly care about the implementation,
but I do care where it's going to end up. :-)  <sys/sysctl.h> is fine
with me, of course.

> uintptr_t isn't wide enough for this particular purpose (and i'm not
> sure why unsigned long isn't simply sufficient in either case).

It's not so much about having an adequately-sized type but about
having a fixed-width one.  Having a netbsd32 ps(1) work on a 64-bit
machine is quite convenient.


- Klaus