On Thursday, 26 April 2012 at 23:28:19 UTC, Trass3r wrote:
enums cause issues because the C enum:

   enum Status {
      STATUS_SUCCESS
   }

has type enum Status and the members are access like STATUS_SUCCESS. The same enum in D is

   enum Status {
      STATUS_SUCCESS
   }

has type Status and the members are accessed using Status.STATUS_SUCCESS

//! bring named enum members into current scope
string flattenNamedEnum(EnumType)()
if (is (EnumType == enum))
{
        string s = "";
        foreach (i, e; __traits(allMembers, EnumType))
        {
s ~= "alias " ~ EnumType.stringof ~ "." ~ __traits(allMembers, EnumType)[i] ~ " " ~ __traits(allMembers, EnumType)[i] ~ ";\n";
        }

        return s;
}

I proposed 'extern(C) enum' to get rid of all those manual aliases but as always nothing happened.

Exactly.

I like that, its cool, but I figured just doing a minor rewrite
of the enum would suffice. Its not that hard since Vim has a
block select, and cairo has some pretty consistent naming that
makes doing macros easy for them, the last step is just to check
that everything gets renamed properly.

--
James Miller

Reply via email to