Date: Thu, 6 Aug 1998 11:31:59 +0000 From: Nicolas Souchu <Nicolas.Souchu@prism.uvsq.fr> To: Mike Smith <mike@smith.net.au> Cc: Terry Lambert <tlambert@primenet.com>, Chuck Robey <chuckr@glue.umd.edu>, freebsd-hackers@FreeBSD.ORG Subject: Re: C and static initialization with unions Message-ID: <19980806113159.49110@breizh.prism.uvsq.fr> In-Reply-To: <199808050149.SAA01073@dingo.cdrom.com>; from Mike Smith on Tue, Aug 04, 1998 at 06:49:27PM -0700 References: <199808050103.SAA27705@usr02.primenet.com> <199808050149.SAA01073@dingo.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 04, 1998 at 06:49:27PM -0700, Mike Smith wrote: [...] >> 4) It still breaks for: >> >> typedef enum { UT_INT, UT_CHAR, UT_PTR } ut_t; >> >> typedef struct { >> ut_t u_type; >> struct foo_t u; /* someone blew a typedef*/ >> } bob_t; >> >> bob_t bobs.p[] = { >> { UT_PTR, &anyvar }, >> { UT_INT, 35 }, /* oops!*/ >> { UT_PTR, NULL } >> }; >> > >The gcc info "extensions/named elements" section describes a useful >extension that lets you cut through much of this crap. > It becomes a FreeBSD related question then... thanks mike ;) Archie said: >>> One non-portable nicety of gcc is that you can do this: union foo { int iarg; char carg; }; static union foo x = { carg: 12 }; -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com <<< Is it allowed in FreeBSD? Is all FreeBSD C source code portable? -- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980806113159.49110>