Is enum static?

bearophile bearophileHUGS at lycos.com
Thu Aug 8 16:19:44 PDT 2013


Ali Çehreli:

> More than that. :) enums are manifest constants.
>
> Imagine that enum as being pasted into source code as is. This 
> used to have surprising effects for AAs, as an enum AA would be 
> instantiated from scratch everywhere that AA enum was used in 
> the code.

I think that some time ago Don has proposed to disallow the 
'enum' tag for things like AAs, on the base that such behavour is 
not efficient, surprising, and maybe even not useful... I don't 
know where his proposal has gone later.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list