C99 has __func__
, but for C++ this will be compiler specific. On the plus side, some of the compiler-specific versions provide additional type information, which is particularly nice when you’re tracing inside a templatized function/class.
Boost library has defined macro BOOST_CURRENT_FUNCTION
for most C++ compilers in header boost/current_function.hpp. If the compiler is too old to support this, the result will be “(unknown)”.