From owner-freebsd-hackers Thu Aug 6 02:29:19 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA02236 for freebsd-hackers-outgoing; Thu, 6 Aug 1998 02:29:19 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from soleil.uvsq.fr (soleil.uvsq.fr [193.51.24.1]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA02231 for ; Thu, 6 Aug 1998 02:29:17 -0700 (PDT) (envelope-from son@cezanne.prism.uvsq.fr) Received: from cezanne.prism.uvsq.fr (rtc103.reseau.uvsq.fr [193.51.24.19]) by soleil.uvsq.fr (8.9.1/jtpda-5.3.1) with ESMTP id LAA29199 ; Thu, 6 Aug 1998 11:28:48 +0200 (METDST) Received: (from son@localhost) by cezanne.prism.uvsq.fr (8.8.8/8.8.5) id LAA00337; Thu, 6 Aug 1998 11:35:44 GMT Message-ID: <19980806113159.49110@breizh.prism.uvsq.fr> Date: Thu, 6 Aug 1998 11:31:59 +0000 From: Nicolas Souchu To: Mike Smith Cc: Terry Lambert , Chuck Robey , freebsd-hackers@FreeBSD.ORG Subject: Re: C and static initialization with unions References: <199808050103.SAA27705@usr02.primenet.com> <199808050149.SAA01073@dingo.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.81e In-Reply-To: <199808050149.SAA01073@dingo.cdrom.com>; from Mike Smith on Tue, Aug 04, 1998 at 06:49:27PM -0700 X-Operating-System: FreeBSD breizh 3.0-CURRENT FreeBSD 3.0-CURRENT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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