From 4839925039382349784
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ccb40040597f37a7
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-03-12 12:50:28 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: Extending enums (was Re: Forward declaration of enum)
Date: Wed, 12 Mar 2003 20:50:27 +0000 (UTC)
Lines: 45
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <memo.20030310212429.56925D@brangdon.madasafish.com>
References: <3E6C739E.9850D2A5@bdal.de>
X-Trace: mail2news.demon.co.uk 1047502227 10535 10.0.0.1 (12 Mar 2003 20:50:27 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 12 Mar 2003 20:50:27 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 18tDBC-0002jm-00
	for mail2news@news.news.demon.net; Wed, 12 Mar 2003 20:50:26 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id HAA15008; Thu, 13 Mar 2003 07:50:23 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Reply-To: brangdon@cix.co.uk
X-Orig-NNTP-Posting-Host: pc1-clif1-6-cust113.nott.cable.ntl.com (80.4.200.113)
X-Orig-X-Trace: fu-berlin.de 1047331461 66945518 80.4.200.113 (16 [57443])
X-Spam-Status: No, hits=-5.6 required=5.0
	tests=QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:18285

dsp@bdal.de (Daniel Spangenberg) wrote (abridged):
> For the same reason, I nearly always encapsulate enumeration 
> definitions into classes, like
> 
> struct Color { enum Type { Red, Orange, Yellow }; };
> 
> because I like the stronger enforcement of the complete name resolution 
> of class namespaces.

I prefer the openness. This is partly because my local compiler supports 
forward enum declarations, so I can write:

    namespace Colour { enum Type; }

If I tried that with a struct I'd come a cropper on the One Definition 
Rule. (I use this language extension a lot - which is part of why I 
advocate making it standard.)


> Why do you think, that Color::Type" is not a convenient identifier? 

It's an invented name, a placeholder purely to satisfy the compiler. I'd 
much rather be able to write:

    Colour c = Colour::Red;

Compare with:

    struct Colour {
        const Colour Red, Green, Blue;
    };
    
    Colour c = Colour::red;

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      brangdon@cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



