Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: Eduardo Horvath <eeh@turbolinux.com>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-kern
Date: 04/17/2000 15:17:19
Eduardo Horvath <eeh@turbolinux.com> writes:
> > Darren Reed <darrenr@reed.wattle.id.au> writes:
> > > > > 	#define PTRTOINT64(foo) ((u_int64_t)(long)(foo))
> > > 
> > > I missed the original, but we should use intptr_t, not long here.
> > > It is architecture size dependant, of course.  IMHO, we use long
> > > too often where we should be using intptr_t.
> > 
> > Yes.  Of course, unless i'm mistaken, 'intptr_t' is a relative
> > newcomer, and most people haven't been educated as to the joys of its
> > use.
> 
> I'm not certain it helps much in this case.  How do you determine whether
> to use intptr_t or uintptr_t when extending a 32-bit address to a 64-bit
> field?  Does C9x address this?

the point is, (long) is not necessarily the same size as a pointer
(which is the assumption in that set of casts)...  intptr_t (and i
guess uintptr_t?) are; they're defined to be.


cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.