William A. Rowe, Jr. wrote:
> 
> Joe Orton wrote:
> > On Mon, Oct 03, 2005 at 08:11:44AM -0400, Jim Jagielski wrote:
> > 
> >>Joe Orton wrote:
> >>
> >>>On Mon, Oct 03, 2005 at 07:50:39AM -0400, Jim Jagielski wrote:
> >>>
> >>>>Just some lines that caught my eye:
> >>>>... Whenever I see conditionals cast to (long) I get
> >>>>suspicious. 
> >>>
> >>>These are all cases where an integer is stored in a pointer; it's safe 
> >>>to assume that a long will fit in a pointer on all platforms which httpd 
> >>>runs on as a practical consideration, and using a cast to long rather 
> >>>than a cast to int will avoid compiler warnings on LP64 platforms.
> >>
> >>... Certainly a union could be
> >>used to avoid this.
> > 
> > I usually end up deciding these issues are so marginal 
> > that there's some better way to spend time fixing real bugs than to try 
> > and break code which works perfectly well ;)
> 
> Joe's correct that this code change works on ILP32, ILP64 and LP64, 
> platforms - but I concur with Jim that for the casual developer, the
> purpose is hard to glean...
> 
> ...perhaps we need an apr_intptr_t type which is a best-fit int for any
> arbitrary void* storage class?
> 

ANSI C specifically allows for pointers to be converted to
a "large enough" integral type. For safety, I would suggest unsigned
long, but whenever we have impl dependent code, we should make
sure it's well documented, abstract it out if possible, or, at
least, confirm during configuration that our assumptions are
correct.

-- 
=======================================================================
 Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
           "If you can dodge a wrench, you can dodge a ball."

Reply via email to