function name inside a funciton

user user at user.com
Fri Apr 11 19:56:47 PDT 2014


Never mind, just discovered __PRETTY_FUNCTION__.


On Saturday, 12 April 2014 at 02:39:23 UTC, user wrote:
> Can someone please tell me how to get a function or method name 
> inside that function/method's body? For example ...
>
> void foo(int x) {
>
>    string name = getFunctionName();
>    assert(name == "foo");
>
> }
>
>
> Compile time or runtime either is OK.
>
> Thanks



More information about the Digitalmars-d-learn mailing list