Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #727

N3242 8.5.1/15 -- braced union declarations limited only to first member

Message-ID <3bd8af8c-bcd3-4fca-a7ce-3e1a3e1dc21b@googlegroups.com> (permalink)
Newsgroups comp.std.c++
From rick.c.hodgin@googlemail.com
Subject N3242 8.5.1/15 -- braced union declarations limited only to first member
Organization unknown
Date 2014-08-30 13:29 -0600

Show all headers | View raw


Taken from:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf

----------
8.5.1 / 15 When a union is initialized with a brace-enclosed initializer,
the braces shall only contain an initializer-clause for the first non-
static data member of the union.

[ Example:
union u { int a; const char* b; };
u a = { 1 };
u b = a;
u c = 1; // error
u d = { 0, "asdf" }; // error
u e = { "asdf" }; // error
--end example ]

----------
Why?

Such a decision severely hobbles the use of unions, limiting their full
functionality to run-time code, and in a case where compile-time non-first
member initialization is more than just possible, it's almost trivial.

I'm thinkin' ... I can't see the reasonin' ... Please help me out.

Gracias. :-)

Best regards,
Rick C. Hodgin


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextNext in thread | Find similar


Thread

N3242 8.5.1/15 -- braced union declarations limited only to first member rick.c.hodgin@googlemail.com - 2014-08-30 13:29 -0600
  Re: N3242 8.5.1/15 -- braced union declarations limited only to first member "Rick C. Hodgin" <rick.c.hodgin@googlemail.com> - 2014-09-16 21:01 -0600
    Re: N3242 8.5.1/15 -- braced union declarations limited only to first member Philip Guenther <guenther@googlemail.com> - 2014-09-17 19:29 -0600
      Re: N3242 8.5.1/15 -- braced union declarations limited only to first member "Rick C. Hodgin" <rick.c.hodgin@googlemail.com> - 2014-09-19 01:06 -0600
        Re: N3242 8.5.1/15 -- braced union declarations limited only to first member "Rick C. Hodgin" <rick.c.hodgin@googlemail.com> - 2014-09-20 01:37 -0600
          Re: N3242 8.5.1/15 -- braced union declarations limited only to first member Martin Bonner <martinfrompi@yahoo.co.uk> - 2014-09-23 14:52 -0600
            Re: N3242 8.5.1/15 -- braced union declarations limited only to first member "Rick C. Hodgin" <rick.c.hodgin@googlemail.com> - 2014-09-24 16:30 -0600
      Re: N3242 8.5.1/15 -- braced union declarations limited only to first  member James Kuyper <jameskuyper@verizon.net> - 2014-09-19 01:06 -0600
      Re: N3242 8.5.1/15 -- braced union declarations limited only to first member Francis Glassborow <Francis.glassborow@btinternet.com> - 2014-09-19 01:06 -0600

csiph-web