httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: general/736: pointers cast as ints of different size - potential memory problems (fwd)
Date Tue, 17 Jun 1997 03:31:05 GMT
On Mon, 16 Jun 1997, Roy T. Fielding wrote:

> >The note_* functions are not callbacks, they reference callbacks.  For
> >example, using my proposed solution, note_cleanups_for_fd becomes:
> >
> >void note_cleanups_for_fd (pool *p, ptr_int fd)
> >{
> >    generic_data gd;
> >
> >    GENERIC_INT (gd) = fd;
> >    register_cleanup (p, gd, fd_cleanup, fd_cleanup);
> >}
> But that isn't the way to do it.  You can achieve the exact same thing,
> without screwing the interface, with
> void note_cleanups_for_fd (pool *p, int fd)
> {
>     register_cleanup (p, (generic_data)fd, fd_cleanup, fd_cleanup);
> }

Well this isn't strictly possible if we follow ANSI C.  That's why I
was suggesting the union as a last resource, and your cast there won't
cast into a union in a portable way.  That's what my macros achieve.
I personally don't mind if we violate ansi this way, because I doubt
we'll see an architecture soon that doesn't allow for this...

> What I don't understand is why you would want to change the type of fd
> to ptr_int when we know an fd is always type int.  I think we may be
> just miscommunicating.

Yeah we were just miscommunicating on that one.


View raw message