http://d.puremagic.com/issues/show_bug.cgi?id=4261



--- Comment #3 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2010-08-30 
05:47:34 PDT ---
I'm not sure I understand what you're saying. An enum in D is a list of
symbolic values of any type (except classes).

For example:

module enums;

import std.stdio;

struct Color
{
    ubyte r, g, b;
}

enum { red = Color(255, 0, 0), green = Color(0, 255, 0), blue = Color(0, 0,
255) }

void foo(Color c)
{
    writefln("%s %s %s", c.r, c.g, c.b);
}

void main()
{
    foo(blue);
}

enums are also used in CTFE, e.g.:

enum float value = someFunc();  // CTFE

Having to use a cast everywhere for an enum would break a lot of code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to