enum

Walter Bright newshound2 at digitalmars.com
Thu Apr 10 22:40:14 PDT 2014


On 4/10/2014 10:29 PM, Jonathan M Davis wrote:
> If you just want to give a list of values names, then you can use manifest
> constants rather than an enumeration.

You could, but then you'd lose the self-documenting aspect of static type 
checking. See the "Color" example.

     alias int Color;

doesn't offer any protection from a Color value getting mixed up with a file 
mode mask.


More information about the Digitalmars-d mailing list