Bug 3999 and 4261

Nick Sabalausky a at a.a
Thu Sep 2 14:57:32 PDT 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:i5p63u$2pl1$1 at digitalmars.com...
> Don:
>> OTOH if each member has an explicitly defined value, it's reasonable to
>> perform logical operations on it.
>
> See my recent answer to Schveighoffer. I think that's not a fully good 
> idea because when you define an enum like that and you use its values as 
> powers-of-two flags, the type system doesn't help you enforce it is a true 
> combination of the flags instead of a generic number (and you may put bugs 
> when you define the values to assign to the flags), so I think something 
> like a std.bitmanip.flagset that produces a struct is better when you need 
> to define a flag set.
>

I think all the discussions we've had about enum make it clear that enum 
suffers from a bit of an identity crisis. It doesn't know what it is and 
ends up being mediocre at everything it dabbles in.




More information about the Digitalmars-d mailing list