On 12/28/2015 09:57 PM, Ali Çehreli wrote:

> anonymous enums

Wow! They are pretty weird:

1) The second form of the AnonymousEnumDeclaration spec is redundant, right?


    enum : EnumBaseType { EnumMembers }
    enum { EnumMembers }            <-- Redundant?
    enum { AnonymousEnumMembers }

The reason is, AnonymousEnumMembers already covers EnumMembers, no?

2) Anonymous enum definitions can have types right inside the list:

    Type Identifier = AssignExpression

enum {
    ulong b = 42, c,   // b and c are ulong
    s = "hello",       // an inferred string between integrals!
    x = 7, y, z

3) The types of x, y, and z are 'int' because 7 is an int (they don't follow the type of 'c'). However, move 's' to the end of the list or remove it altogether, then x, y, and z become ulong! Weird. Ok, I'm going to forget about this feature now. :p


Reply via email to