public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: Jeroen Dobbelaere <Jeroen.Dobbelaere@tvd.be> To: Aurel Balmosan <ab@orga.com> Cc: egcs-bugs@cygnus.com Subject: Re: Initialising an union. Date: Tue, 18 Aug 1998 11:46:00 -0000 [thread overview] Message-ID: <35D9C176.873FB5F6@tvd.be> (raw) In-Reply-To: <35D842BF.93D35CB8@orga.com> Hi, The initialisation of a union only initializes the first member of the union, not the 'largest' member. (the remaining part can be uninitialized. (from the december 1997 draft working paper :) 8.5 Initializers [dcl.init] 1 A declarator can specify an initial value for the identifier being [...] 5 To zero-initialize storage for an object of type T means: [..] --if T is a union type, the storage for its first data member5) is zero-initialized; [.....] 15When a union is initialized with a brace-enclosed initializer, the braces shall only contain an initializer for the first member of the union. [Example: union u { int a; char* b; }; u a = { 1 }; u b = a; u c = 1; // error u d = { 0, "asdf" }; // error u e = { "asdf" }; // error --end example] [Note: as described above, the braces around the ini- tializer for a union member can be omitted if the union is a member of another aggregate. ] Greetings, Jeroen Dobbelaere
next prev parent reply other threads:[~1998-08-18 11:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 1998-08-17 7:51 Aurel Balmosan 1998-08-18 11:46 ` Jeroen Dobbelaere [this message] 1998-08-19 4:40 ` Aurel Balmosan 1998-08-19 10:03 ` Jeroen Dobbelaere 1998-08-18 0:39 Aurel Balmosan 1998-08-18 18:14 ` Alexandre Oliva 1998-08-19 2:44 ` Aurel Balmosan 1998-08-19 14:51 ` Alexandre Oliva 1998-08-20 2:41 ` Aurel Balmosan 1998-08-20 8:15 ` Alexandre Oliva
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=35D9C176.873FB5F6@tvd.be \ --to=jeroen.dobbelaere@tvd.be \ --cc=ab@orga.com \ --cc=egcs-bugs@cygnus.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).