[Issue 10875] Introduce functionLinkageType to mirror functionLinkage with an enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 23 04:54:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10875



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-23 04:54:39 PDT ---
(In reply to comment #0)
> But since it's too late to change the return type, I propose we introduce an
> enum version:

Actually a reasonable alternative is to simply introduce the LinkageType enum
which will have a string as its base type, so it can be used with the
functionLinkage function:

enum LinkageType : string
{
    D = "D",
    C = "C",
    Windows = "Windows",
    Pascal = "Pascal",
    Cpp = "C++"
}

-----
import std.traits;

extern(C) void func()
{
}

void main()
{
    enum linkage = functionLinkage!func;

    static if (linkage == LinkageType.C)
    {
    }
    else
    static if (linkage == LinkageType.D)
    {
    }
}
-----

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


More information about the Digitalmars-d-bugs mailing list