__func__
is documented in the C++0x standard at section 8.4.1. In this case it's a predefined function local variable of the form:
static const char __func__[] = "function-name ";
where "function name" is implementation specfic. This means that whenever you declare a function, the compiler will add this variable implicitly to your function. The same is true of __FUNCTION__
and __PRETTY_FUNCTION__
. Despite their uppercasing, they aren't macros. Although __func__
is an addition to C++0x
g++ -std=c++98 ....
will still compile code using __func__
.
__PRETTY_FUNCTION__
and __FUNCTION__
are documented here http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/Function-Names.html#Function-Names. __FUNCTION__
is just another name for __func__
. __PRETTY_FUNCTION__
is the same as __func__
in C but in C++ it contains the type signature as well.