Types soup with enum and bool

Maxim Fomin maxim at maxim-fomin.ru
Tue Oct 29 15:00:53 PDT 2013


On Tuesday, 29 October 2013 at 21:24:35 UTC, bearophile wrote:
> Maxim Fomin:
>
>> Bools being integer types is reason of your problem with enums.
>
> The reason of that problem of mine with enums is that they 
> convert implicitly to integers. And I still don't know the 
> original rationale of Walter of this design mistake.
>
> Bye,
> bearophile

It works according to spec: "A named enum member can be 
implicitly cast to its EnumBaseType, but EnumBaseType types 
cannot be implicitly cast to an enum type. "

In this respect D enums behave like C enums.


More information about the Digitalmars-d-learn mailing list