Are anonymous enums mostly available for performance reasons?

Mike Parker aldacron at gmail.com
Sat Apr 3 04:59:45 PDT 2010


BobR wrote:
> When are anonymous enums preferred over named enums? Maybe they are in 
> the language for historical reasons? Or are they truly useful enough to 
> warrant having a 2 kinds of enums? 
> 
> 

I use them to create D bindings to C libraries. They are useful for 
translating both C enums and #defines. Plus, if porting C++ code they 
make a good tool for translating global constants. Also, and this is a 
big one for me, anonymous enums generate no TypeInfo, which can save a 
lot of space in the binary over named enums.



More information about the Digitalmars-d mailing list