From -5780669581244286319
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7538bd92d6a9557a
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1995-01-20 21:03:42 PST
Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!spool.mu.edu!olivea!koriel!male.EBay.Sun.COM!engnews2.Eng.Sun.COM!clamage
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: short enum, bool
Date: 21 Jan 1995 05:03:42 GMT
Organization: Sun Microsystems Inc., Mountain View, CA
Lines: 34
Message-ID: <3fq4je$ekb@engnews2.Eng.Sun.COM>
References: <scottyD2DFML.MDt@netcom.com> <790596622snz@wslint.demon.co.uk> <790640447snz@thone.demon.co.uk>
NNTP-Posting-Host: taumet.eng.sun.com
X-Newsreader: NN version 6.5.0 #21 (NOV)

andys@thone.demon.co.uk (Andy Sawyer) writes:

>In article <790596622snz@wslint.demon.co.uk>
>           Kevlin@wslint.demon.co.uk "Kevlin Henney" writes:
>> 
>> Hey, isn't it about time somebody asked about enum inheritance? (HHOK)
>> Nobody's suggested adding that to the language for at least a couple of months
>> <grin>

You can get the equivalent of inheriting from enum under the new rules.
An enum object must contain enough bits to represent all its values.
You can create new values of that enum type that don't fall outside
the range thus extended to that many bits. Example:

	enum error { info=0, warning=500, serious=1000, fatal=1500 };

Any constant or object of type 'error' may have any value between
0 and 2047. So we now can write

	const error resources_low = 1;
	const error obsolescent = 501;
	const error unknown_request = 1001;
	const error out_of_memory = 1501;

We can extend the enum whenever and wherever we like.

> .. how about being able to derive from int then? <even bigger grin>
> (In case you were wondering, I wanted to do this once, many years ago!)

This has been informally proposed, and would make a lot of things
nicer. I do not believe it will be in the first C++ standard.
Maybe some day.
--
Steve Clamage, stephen.clamage@eng.sun.com


