The __FUNCSIG__ macro

I cannot believe that I didn’t know of this macro all this while. Countless times in the past, when I had to track the life-cycle of an object, I had put code such as printf("inside ctor") and printf("inside function F(int)") in my class, and now I find out that all I had to use was the __FUNCSIG__ macro.

ref class R
    void Hello()
    int index;


    R^ r = gcnew R();
    delete r;

/*** Output

__clrcall R::R(void)
void __clrcall R::Hello(void)
__clrcall R::~R(void)


Other similar macros are __FUNCDNAME__ which returns the decorated name and __FUNCTION__ which returns the undecorated name (without the full signature). These are available in VC++ 2003 and 2005, but I am not sure if they existed in VC++ 6, so perhaps someone could confirm that.

Posted in C++

3 thoughts on “The __FUNCSIG__ macro

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s