Received: (from majordom@localhost) by hyperreal.com (8.8.5/8.8.5) id UAA11638; Mon, 16 Jun 1997 20:23:38 -0700 (PDT) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by hyperreal.com (8.8.5/8.8.5) with SMTP id UAA11587 for ; Mon, 16 Jun 1997 20:23:31 -0700 (PDT) Received: (qmail 27366 invoked by uid 500); 17 Jun 1997 03:31:05 -0000 Date: Mon, 16 Jun 1997 20:31:05 -0700 (PDT) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: general/736: pointers cast as ints of different size - potential memory problems (fwd) In-Reply-To: <9706161557.aa17200@paris.ics.uci.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org 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. Dean