httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: svn commit: r293305 - in /httpd/httpd/branches/2.2.x/modules: dav/fs/dbm.c
Date Mon, 03 Oct 2005 12:38:02 GMT
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:
> > > > 
> > > > >  
> > > > > -    *context = (void *)(value == 'T');
> > > > > +    *context = (void *)((long)(value == 'T'));
> > > > >  
> > > > > -    int value = context != NULL;
> > > > > +    long value = context != NULL;
> > > > >      apr_fileperms_t perms = resource->info->finfo.protection;
> > > > > -    int old_value = (perms & APR_UEXECUTE) != 0;
> > > > > +    long old_value = (perms & APR_UEXECUTE) != 0;
> > > > >  
> > > > 
> > > > Huh? 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.
> > > 
> > 
> > The above explanation worries me to no end. :) Certainly a union could be
> > used to avoid this.
> 
> Well there are solutions, sure, not sure how a union would help here.  
> Try it and see... 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 ;)
> 

At the very last, if we are "assuming" behavior which is
specifically implementation dependent, then a test during
configure time that ensures sizeof(void *) <= sizeof(long)
makes sense.

There is no room, IMO, for silent hidden assumptions
in httpd.

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

Mime
View raw message