Function name from function pointer

Paul D Anderson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 11 11:28:35 PDT 2015


Is there a way to return the name of a function (a string) from a 
pointer to that function?

Function pointer example from D Reference:
---
int function() fp;

void test()
{
     static int a = 7;
     static int foo() { return a + 3; }

     fp = &foo;
}

void bar()
{
     test();
     int i = fp();       // i is set to 10
}
---

Can I get "foo" from fp?

Paul




More information about the Digitalmars-d-learn mailing list