PhobosWatch: manifest => enum
Bruce Adams
tortoise_74 at yeah.who.co.uk
Sat Dec 29 04:37:15 PST 2007
On Sat, 29 Dec 2007 12:34:15 -0000, Bruce Adams
<tortoise_74 at yeah.who.co.uk> wrote:
> On Sat, 29 Dec 2007 08:36:07 -0000, Janice Caron
> <caron800 at googlemail.com> wrote:
>
>> On 12/29/07, Don Clugston <dac at nospam.com.au> wrote:
>>> Does this compile?
>>>
>>> enum : cfloat { A=2, B, C }
>>
>> Even more interestingly, what about
>>
>> enum : ifloat { a = 2i, b };
>>
>> If b has to equal (a+1), then there is no way it can be the same type
>> as a.
>
> I think Doug's arguments are the must compelling yet.
Obviously I meant Don's arguments. Oops.
Which by the way is exactly the "enum hack" we were sometimes forced to
use in C++ before it was sanitised prior to the ISO standard.
On 12/29/07, Don Clugston <dac at nospam.com.au> wrote:
"The primary function of enum is to create a TYPE based on a GROUP of
related INTEGRAL constants. You can abuse the facility to declare integral
constants, but that's a secondary feature at best. The problem is that
using enum for abtritrary types is a very poor match for the primary
feature of enums.
We don't want to create a type; we don't want a grouping; and the values
are not integral."
More information about the Digitalmars-d
mailing list