Proposal new type "flags"
Jason House
jason.james.house at gmail.com
Wed Jan 10 18:00:10 PST 2007
I think this is a start, but I think that a complete discussion of how
enums are used in C/C++ is required.
I think that enums are used in one of two methods:
* As bit-based masks
* As a (complete) set of values that a variable can take
I'd be ok with calling the first flags and the 2nd enums. This would
clean up the issues with printing enums (my personal pet peeve with D).
I think that this'll need to be expanded to include multi-bit masks and
the option to explicitly specify the values for particular masks.
Rueschi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi folks,
>
> many functions may be controlled by some flags that are combined
> in an uint value. However, this is not type safe. You can unintentionally
> provide/combine flags that are not intended for that function.
> The solution would be a "flags" data type, similar to enums:
More information about the Digitalmars-d
mailing list