httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: WWW Form Bug Report: "problems compiling on Alpha OSF1" on OSF/1
Date Tue, 19 Dec 1995 01:41:11 GMT
> 
> In reply to Ben Laurie who said
> > 
> > Yeah, but actually what is being done is the other way round (that is, casting
> > an int to a pointer and hoping to get the int back). Whilst this is strictly
> > broken, only the recent introduction of 64 bit architectures has proved it so.
> > Since, in practice, the int is a file descriptor, it'll work anyway.
> 
> Why would the fact that it's a file descriptor make any difference? 

Because file descriptors are small.

> 
> > 
> > The correct way to do this, of course, is with a union.
> 
> umm, well, reagardless of the fact that 64 bit archs make it obvious, the code
> would have been strictly broken regardless. We've just been lucky up until
> now that all the platforms happen to work.
> 
> Casting an int to a pointer and hoping to get the int back is just as
> dangerous since nothing says that will actually work as expected. The
> int could be 64 bits whereas a pointer could be less, who says the
> address space has to match the int size?
> 
> This is a little academic since I've never seen a machine where that would
> happen but it's bogus code nonetheless and I don't like bogus code :-) To get
> back to the original point, gcc is absolutely correct in flagging the code
> as potentially dangerous and we should fix such warnings properly.

Oh yes, as is cc on SCO in warning about 3,000,000 missing function
definitions, signed/unsigned mismatches and lots of other good stuff. I was
only trying to suggest that the cleanup belongs in 1.1.

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message