Date: Tue, 4 Aug 1998 20:29:49 -0400 (EDT) From: Charles Youse <cyouse@artemis.syncom.net> To: Nicolas Souchu <Nicolas.Souchu@prism.uvsq.fr> Cc: FreeBSD Hackers <freebsd-hackers@FreeBSD.ORG> Subject: Re: C and static initialization with unions Message-ID: <Pine.NEB.3.96.980804202802.17173A-100000@artemis.syncom.net> In-Reply-To: <19980804185938.36803@breizh.prism.uvsq.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Aug 1998, Nicolas Souchu wrote: > union foo_t { > int i; > char c; > void *p; > }; > > static union foo_t bar = { (void *)&anyvar }; If you wish to initialize these unions using void pointers, then the void pointer element comes first. Otherwise, you're stuck using casts, which aren't necessarily safe. C dictates that union initializations take the form of the first member of the union. Chuck To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.980804202802.17173A-100000>