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


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

Is a union a kind of class?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.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, 31 Aug 2013 01:20:02 -0500
Return-Path <cppmods@mcgurn.dreamhost.com>
Sender std-cpp-request@vandevoorde.com
Approved james.dennett@gmail.com
Message-ID <52204496.5050408@bawi.org> (permalink)
Newsgroups comp.std.c++
From Seungbeom Kim <musiphil@bawi.org>
Subject Is a union a kind of class?
Organization unknown
Content-Type text/plain; charset=us-ascii
X-Original-Date Fri, 30 Aug 2013 00:07:02 -0700
X-Submission-Address std-cpp-submit@vandevoorde.com
To undisclosed-recipients:;
Date Sat, 31 Aug 2013 01:12:51 CST
Lines 23
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-k5Nytw4FNC/YTWljV7bHaYLr1ZdNTkw2uz5r0aKdgLB+iwWdypkNPjoCPC91Z+ykp/x+Ku6rr8UZMGz!bcC+upZ1oTeH3t/s6fukd+H79vWd3X7ZFph+kURAd6SZKfAZtA==
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 2019
X-Received-Bytes 2160
Xref csiph.com comp.std.c++:651

Show key headers only | View raw


In the taxonomy of C++ types, is a union a (kind of) class?

9[class]/5 clearly says, "A union is a class defined with the class-key
union [...]". 5.1.2[expr.prim.lambda]/3 and 9[class]/10 also mention "a
non-union class [type]", and 5.9[expr.rel]/2 "provided their class is
not a union", all of which imply that a union is a class.

On the other hand, 3.9.2[basic.compound]/1 lists classes and unions
separately, which strongly implies that a union is not a class.

If a union is a class, I think 3.9.2/1 is confusing (at best) and should
be considered a defect.

--
Seungbeom Kim


[ 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

Is a union a kind of class? Seungbeom Kim <musiphil@bawi.org> - 2013-08-31 01:12 -0600
  Re: Is a union a kind of class? Daniel Krügler <daniel.kruegler@googlemail.com> - 2013-08-31 23:52 -0700
  Re: Is a union a kind of class? James Kuyper <jameskuyper@verizon.net> - 2013-08-31 23:52 -0700
  Re: Is a union a kind of class? johnolithicsoftware@googlemail.com - 2013-12-19 11:24 -0800
    Re: Is a union a kind of class? "news" <news@fx21.iad.highwinds-media.com> - 2013-12-22 19:27 -0600
      Re: Is a union a kind of class? James Kuyper <jameskuyper@verizon.net> - 2013-12-27 13:11 -0600
        Re: Is a union a kind of class? evansl <cppljevans@googlemail.com> - 2013-12-29 23:00 -0600
          Re: Is a union a kind of class? James Kuyper <jameskuyper@verizon.net> - 2013-12-31 17:45 -0600

csiph-web