On 04/05/2013 01:48 PM, Chad Joan wrote:
On 04/05/2013 01:18 PM, Andrej Mitrovic wrote:
On 4/5/13, Chad Joan<[email protected]> wrote:
Enums do not have instances.

Sure they do.

enum Foo
{
X,
Y
}

void test(Foo foo) { }

void main()
{
Foo foo = Foo.Y;
test(foo);
}

Where's the instance?

All I see is

void test(int foo) { }

void main()
{
int foo = 1;
test(foo);
}

There is no stateful aggregation for me to see here.

I can probably word this another way, since I might not have been entirely clear.

Things like structs and classes occupy memory. Enums do not. Foo.Y expands to an immediate value and has no storage in the program's data segment. Enums place constraints on other things that do occupy memory: usually integers.

Reply via email to