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


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

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newspeer1.nac.net!border4.nntp.dca.giganews.com!backlog4.nntp.dca3.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Sat, 20 Sep 2014 01:40:01 -0500
Return-Path <cppmods@glengoyne.dreamhost.com>
Sender std-cpp-request@vandevoorde.com
Approved james.dennett@gmail.com
Message-ID <673d41b7-8394-4e0a-ad40-c422d1941b20@googlegroups.com> (permalink)
Newsgroups comp.std.c++
From "Rick C. Hodgin" <rick.c.hodgin@googlemail.com>
Subject Re: N3242 8.5.1/15 -- braced union declarations limited only to first member
Organization unknown
References <3bd8af8c-bcd3-4fca-a7ce-3e1a3e1dc21b@googlegroups.com> <0afb2699-65e9-4a05-9f0b-c8bae7a18ad9@googlegroups.com> <a49b07f5-e922-4e9e-977a-cb9dddd86928@googlegroups.com> <74729178-1dcf-48c5-93a2-bf00314f7e10@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
X-Original-Date Fri, 19 Sep 2014 01:04:51 -0700 (PDT)
X-Submission-Address std-cpp-submit@vandevoorde.com
To undisclosed-recipients:;
Date Sat, 20 Sep 2014 01:37:26 CST
Lines 36
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-EJ4jtaw85VsNcOSta/YBJNTJk7pk3ONeOk1RxQgX0qOQKWxjOwbuwkiy+Q4QIFHTeEBXnhNdkRqupfZ!KPXUjdTdUsHfsBqosEaKu+gMfQbY/F/YD5OFDf/iHfSkd6lKhBrM/D4+2z3tQpDgDLOlqPxBGxo8!kBN3o071byw=
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2393
Xref csiph.com comp.std.c++:733

Show key headers only | View raw


Should have been:

-----
I would like the compiler to determine the union member by its type
when possible.

struct SExample
{
    union {
        int i;
        float f;
    };
};

SExample myArray[] =
{
    { 10 }, // Initialized to i member as int
    { 3.14f } // Initialized to f member as float
};

Also, on conflicting types, such as 5 for int and
char, if the bytes they occupy would all map to
the same location in the union, the cast would
not be required.

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 | NextPrevious in thread | Next 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