enum

Walter Bright newshound2 at digitalmars.com
Thu Apr 10 22:52:38 PDT 2014


On 4/9/2014 9:16 PM, Mike wrote:
> Perhaps using enum for bit flags is fundamentally incorrect and only done
> because there is no language support for bit flags.  If bit flags were a
> first-class citizen of the language with its own semantics, the proposal
> wouldn't be so restrictive.  Adding some bit flag language support may be one
> way to improve enum and the overall language semantics at the same time.

Bit flag usage is often more complex than just bit flags. Sometimes there are 
"unions" of different meanings for some bit sequences depending on the state of 
other bits.

Besides, bit flags aren't the only instance of "an integral type where some 
values have names". The Color enum is another one.



More information about the Digitalmars-d mailing list