www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5099] New: Add enum size property

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5099

           Summary: Add enum size property
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ah08010-d yahoo.com



PDT ---
Presently, enums support these properties:

.init = lexically-first member value
.min = smallest value
.max = largest value
.sizeof = size of underlying storage type

I propose adding another property, .length

The value would be the array-declaration-friendly number of elements in the
enum. Thus, 

enum E { A, B, C };

int[ E.length ] counters; // int[3]

There is always the possibility that enum values would be declared as
duplicates of each other:

enum F { A = 0, B, C = 0 };

In that case, .length would _still_ return 3, because it's defined at the
number, not the number(unique) or anything. (And because not all enumerated
types will supported ==).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5099


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



See bug 4997

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