__func__
, __FUNCTION__
and __PRETTY_FUNCTION__
are not string literals, like __FILE__
, but are created like static local char array variables to the function you are using them from. So, the PSTR()
macro will fail since you cannot use an array variable to initialize another array variable like that.
__func__
is described in C11, §6.4.2.2 ¶1:
The identifier
__func__
shall be implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration
static const charappeared, where__func__
[] = "function-name";function-name
is the name of the lexically-enclosing function.
According to the GCC manual, __FUNCTION__
and __PRETTY_FUNCTION__
are just synonyms for __func__
in C (__PRETTY_FUNCTION__
is more verbose for C++).