Date: Tue, 4 Aug 1998 15:09:11 -0400 (EDT) From: Chuck Robey <chuckr@glue.umd.edu> 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.BSF.4.00.9808041508210.409-100000@picnic.mat.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: > Hi there, > > A question about C and static initialization of unions: > > suppose, > > union foo_t { > int i; > char c; > void *p; > }; > > static union foo_t bar = { (void *)&anyvar }; > > The compiler says "warning, making integer from pointer without a cast"... > Which is true and could lead to bad asm code. > > Is there a way to do this properly? Should I forgive unions or what else? No, you forgot to mention which union memeber to use. Your foo_t.p would do nicely. > > -- > Nicolas.Souchu@prism.uvsq.fr > FreeBSD - Turning PCs into workstations - http://www.FreeBSD.org > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > > ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@glue.umd.edu | communications topic, C programming, and Unix. 213 Lakeside Drive Apt T-1 | Greenbelt, MD 20770 | I run Journey2 and picnic (FreeBSD-current) (301) 220-2114 | and jaunt (NetBSD). ----------------------------+----------------------------------------------- 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.BSF.4.00.9808041508210.409-100000>