From 7931487371119628167
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ccb40040597f37a7
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-03-07 12:17:50 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: francis.glassborow@ntlworld.com (Francis Glassborow)
Newsgroups: comp.std.c++
Subject: Re: Extending enums (was Re: Forward declaration of enum)
Date: Fri, 7 Mar 2003 20:17:49 +0000 (UTC)
Organization: Southfield Microcomputer SS
Lines: 36
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <d5omIwIsJHa+EwBZ@robinton.demon.co.uk>
References: <pOqblMCSSSX+Ewcy@robinton.demon.co.uk>
 <memo.20030302145753.26945C@brangdon.madasafish.com>
 <m3n0kdt4cg.fsf@uniton.integrable-solutions.net>
 <mKY8a.1209$U24.78230781@newssvr21.news.prodigy.com>
 <PNE21WKuwwiy-pn2-dMoOpvv8cPkQ@zamboni.stiscan.com>
Mime-Version: 1.0
Content-Type: text/plain;charset=us-ascii;format=flowed
X-Trace: mail2news.demon.co.uk 1047068269 21841 10.0.0.1 (7 Mar 2003 20:17:49 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 7 Mar 2003 20:17:49 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18rOHr-0005g8-00
	for mail2news@news.news.demon.net; Fri, 07 Mar 2003 20:17:48 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id HAA26157; Sat, 8 Mar 2003 07:17:43 +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-Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
X-Newsgroups: comp.std.c++
X-User-Agent: Turnpike/6.02-U (<TilyaeicE$WmMOP9F8P4$y3lmP>)
X-MailScanner: PASSED (v1.2.7 98112 h27ALCiC099479 mailbox4.ucsd.edu)
X-Spam-Status: No, hits=-8.6 required=5.0
	tests=NOSPAM_INC,REFERENCES,SIGNATURE_SHORT_DENSE,
	      SPAM_PHRASE_00_01,USER_AGENT
	version=2.41
Xref: archiver1.google.com comp.std.c++:18227

In article <PNE21WKuwwiy-pn2-dMoOpvv8cPkQ@zamboni.stiscan.com>, 
kgwzamboni-news@zambonistiscan.com writes
>On Tue, 4 Mar 2003 16:45:34 UTC, nagle@animats.com (John Nagle) wrote:
>How about also making them more like real types.
>
>enum Color( Red, Orange, Yellow );
>enum Fruit( Orange, Apple, Grapes );
>
>Except when assigning them directly to ints, the compiler is capable
>of determining which Orange it is.
>For that case allow the cast like Color(Orange).
>
>Then dumb things like "Color x = Grapes;" would be flaged.

However we hit the same problem that we have with forward declaration, 
that of different enums having different sizes in C++.

Yes I know derived class objects are usually larger than their base 
class objects, but in the case of enums we have the problem of 
enumeration constants. Suppose in the above example that Colour 
instances have a size of 1 and Fruit ones have a size of 2. What should 
be the size of Red before the definition of Fruit, and after it?


-- 
ACCU Spring Conference 2003 April 2-5
The Conference you cannot afford to miss
Check the details: http://www.accuconference.co.uk/
Francis Glassborow      ACCU

---
[ 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                       ]



