Possible Duplicate:
Is it ever possible to get the current (member) function name in C++?
If given a function int func(args)in C or C++ is there a way to get the name, or even signature, of the function fromwith in the body of func
I would like to be able to do something like this:
void func(void)
{
printf("%s", funcinfo.sig);
}
and have the output be:
"void func(void)"
does anyone know of a way to do this?
There is
__PRETTY_FUNCTION__predefined identifier with gcc:it will print :
with gcc in C++
and
with gcc in C
Note that this identifier is a gcc extension. In Standard C, there is the predefined identifier
__func__but which prints only the function name (C or C++)