Re: Squid 1.2 beta 15 with latest patches (26 Feb 18:15 UTC)

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 02 Mar 1998 23:26:40 +0100

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Alex Rousskov wrote:

> is a union of all of those types. Well, at least my gcc eats
> it just fine. Of course, some compilers/users might prefer
> (void *) and then type casting.. :)

Which is only safe if you first cast the (void *) back to the real type,
and then to the union. Casting it directly to the union type breaks
portability (there is both alignment and size reasons to this). The
reason why GCC can do a automatic conversation is that the converstaion
is done BEFORE the function call.

subtype -> union conversation is not ANSI C.

The only way to do this in a portable way is to use a (void *) argument,
and manually typecast it back to the real type and then assign it to the
proper union subtypelement (or to store it as void * and defer the type
casting until the value is used).

/Henrik

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:47 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:43 MST