Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: Eduardo Horvath <email@example.com>
From: Chris G. Demetriou <firstname.lastname@example.org>
Date: 04/17/2000 15:17:19
Eduardo Horvath <email@example.com> writes:
> > Darren Reed <firstname.lastname@example.org> 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.
Chris Demetriou - email@example.com - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.