Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail From: Phil Bouchard Newsgroups: comp.std.c++ Subject: Re: New strongly type enum proposal featuring inherited enums Date: Tue, 23 Aug 2011 18:20:10 -0700 (PDT) Organization: albasani.net Lines: 28 Sender: std-cpp-request@vandevoorde.com Approved: stephen.clamage@oracle.com Message-ID: <4e52bed4$1@news.x-privat.org> References: <4e49ea26$2@news.x-privat.org> <4e4ba09e$0$6636$9b4e6d93@newsspool2.arcor-online.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Trace: news.albasani.net N//3A8hzzrWG54UvKihT/ZlDoGeeQyZx7C8ZcIt203lwM9UhSsbJAjkZPSdA+G1lnSIzE9/LQ2Gv4HvFI6k06w== NNTP-Posting-Date: Wed, 24 Aug 2011 12:10:55 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="+dDxySwCtWUm8JKVId4i1MQ+4ARRlWQrKew1T/rtL928i+3PvcObzdyf2NsXrY5UPOgqnHw6Vq0MVnBkWKbvF3ohK4ZeaV8gcpPIq4cQsTIC4TJoFMPqH3almykLNe8J"; mail-complaints-to="abuse@albasani.net" X-Mailer: Perl5 Mail::Internet v2.05 X-Submission-Address: std-cpp-submit@vandevoorde.com Cancel-Lock: sha1:rdL/+g5J0aUSDNOqpQNT6c6Y+Jc= X-Original-Date: Mon, 22 Aug 2011 16:40:48 -0400 Xref: x330-a1.tempe.blueboxinc.net comp.std.c++:233 On 8/18/2011 9:52 AM, Marcel Müller wrote: > >> 3) Redefining the underlying type could be easily done with: >> enum class Val { unsigned long E1, E2, E3, E4 }; > > This implies that the type is specific to each enum constant. It isn't. IMO > > enum class Val: unsigned long > > is fine. Val is an unsigned long, but it cannot be implicitly > converted because it is a private base. I made another mistake. The bitfields technically should be declared as follows: enum class Val { unsigned long E1 : 2, E2 : 2, E3 : 2, E4 : 2 } I'm sure the syntax could change to the following: enum class Val { unsigned long E1, E2, E3, E4 : 2 } -Phil -- [ 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 ]