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


Groups > comp.lang.c++ > #13699

Re: one enum is a subset of another

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Thomas Boell <tboell@domain.invalid>
Newsgroups comp.lang.c++
Subject Re: one enum is a subset of another
Date Thu, 2 Feb 2012 02:38:46 +0100
Organization albasani.net
Lines 33
Message-ID <20120202023846.274d007a@arcadia> (permalink)
References <7aac0ea8-61ab-481e-80a6-c9ab215b009e@gi10g2000vbb.googlegroups.com> <20120201140814.3c116fb2@arcadia> <jgciba$f4c$1@portraits.wsisiz.edu.pl>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net EpQ9yAvN8tvI0i3fMQ+jxYJCGJudE6hNTKYUgavnTQ1DwLa39s44ewb/1CCM1RhSZy4wGMKCbKQKcx2+NRdiKw==
NNTP-Posting-Date Thu, 2 Feb 2012 01:38:46 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="MmmSL7mSP+H9WHRBp/mVMUXYnuDtxvnegPXPlQQX12SUgqztovncvepSZa/cuo1rig9CjsgMKuJwu/0Uz15Qzar6fTeT/aTwOiZCKjjUD+2wWMAEQifjsNnSzWLGg7pY"; mail-complaints-to="abuse@albasani.net"
X-Newsreader Claws Mail 3.7.8 (GTK+ 2.24.4; i686-pc-linux-gnu)
Cancel-Lock sha1:m5gA2lM0kQf8BqZh3eBl2bOKWuw=
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:13699

Show key headers only | View raw


On Thu, 02 Feb 2012 00:37:15 +0100
"Matt D." <nospam@invalid.local> wrote:

> On 2/1/2012 14:08, Thomas Boell wrote:
> > You could do something like this:
> >
> > #define FRUIT_VALUES	\
> >      APPLE,	\
> >      BANANA,	\
> >      ORANGE
> >
> > enum Fruit
> > {
> > 	FRUIT_VALUES
> > };
> >
> > enum Things
> > {
> > 	FRUIT_VALUES,
> > 	BEERCAN, CAR, ALOT
> > };
> >
> > Whether using the preprocessor like this is "good style" depends on
> > your point of view.
> 
> It's seems very much like inheritance, so it made me think that perhaps 
> using something along the following could be of use: 
> http://www.codeproject.com/Articles/16150/Inheriting-a-C-enum-type

He forgot to start the NewFruits enum values after the end of Fruit, so
he will not be able to distinguish Apples from Oranges.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

one enum is a subset of another Christopher <cpisz@austin.rr.com> - 2012-01-31 14:56 -0800
  Re: one enum is a subset of another Paul N <gw7rib@aol.com> - 2012-01-31 15:19 -0800
    Re: one enum is a subset of another Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-31 23:56 +0000
  Re: one enum is a subset of another Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-02-01 09:51 +0100
    Re: one enum is a subset of another Larry Evans <cppljevans@suddenlink.net> - 2012-02-01 11:46 -0600
      Re: one enum is a subset of another Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-02-01 21:14 +0100
  Re: one enum is a subset of another Thomas Boell <tboell@domain.invalid> - 2012-02-01 14:08 +0100
    Re: one enum is a subset of another Tobias Müller <troplin@bluewin.ch> - 2012-02-01 21:34 +0000
    Re: one enum is a subset of another "Matt D." <nospam@invalid.local> - 2012-02-02 00:37 +0100
      Re: one enum is a subset of another Thomas Boell <tboell@domain.invalid> - 2012-02-02 02:38 +0100
  Re: one enum is a subset of another Larry Evans <cppljevans@suddenlink.net> - 2012-02-01 12:28 -0600

csiph-web