enums

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 30 10:28:59 PDT 2014


On 05/30/2014 08:30 AM, Russel Winder via Digitalmars-d-learn wrote:

 >          enum double p0 = 0.0045;

As others have already said, p0 is a manifest constant. Interestingly, 
it can be thought of like a C macro, being pasted inside source code.

Avoid enums for arrays and associative arrays as they are hidden 
performance sinks. The constant gets regenerated at runtime every time 
it is used in an expression.

Ali



More information about the Digitalmars-d-learn mailing list