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


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

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

Message-ID <e3d70394-7bb0-4e19-abf8-49656413d020@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 (1 earlier) <0afb2699-65e9-4a05-9f0b-c8bae7a18ad9@googlegroups.com> <a49b07f5-e922-4e9e-977a-cb9dddd86928@googlegroups.com> <74729178-1dcf-48c5-93a2-bf00314f7e10@googlegroups.com> <673d41b7-8394-4e0a-ad40-c422d1941b20@googlegroups.com> <9a05e6e8-ab78-482e-ae47-fb10626b5bea@googlegroups.com>
Date 2014-09-24 16:30 -0600

Show all headers | View raw


On Tuesday, September 23, 2014 4:00:02 PM UTC-4, Martin Bonner wrote:
> On Saturday, 20 September 2014 07:40:02 UTC+1, Rick C. Hodgin  wrote:
> > 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.
>
> That would be a terrible idea!  It means that code would
> compile on a little-endian machine, but not a big-endian one.
> (For example)

I think to remove it from allowance would place an excessive and
unnecessary burden on every little-endian developer, demanding
that they cast everything explicitly when it's not needed for
their architecture.  Not every developer writes cross-architecture
code.

And there are and should be some penalties big-endian developers pay
for their choices.  The burden should be on THOSE developers, and not
on ALL developers because of shortcomings in their architecture. :-)

> I agree that C99 designated initializers would be a much
> better solution:
> - They have already been cast into standardese.
> - If gcc doesn't support them for C++, it's probably not hard to
>   make it do so (so we can gain implementation experience).
> - They would be of more general utility than just initializing
>   unions.

I agree that designated initializers should be available.  I think
that would be a great feature.

I also think that requiring designated initializers places an excessive
and unnecessary burden on EVERY developer when the underlying fundamental
initializer is unambiguous and could be populated correctly by value
alone, or could be correctly mapped as on little-endian architectures,
or even on some big-endian combinations also mapped (char to int, for
example, could be mapped merely by being offset by 3 bytes in the data).

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