So I have this snippet of code
wchar_t funcName[] = __FUNCTIONW__;
but the problem with __FUNCTIONW__
is it has class info in the name when all I want is the function name. Now__FUNCTIONW__
just calls _CRT_WIDE(__FUNCTION__)
which made me think I could call _CRT_WIDE(__func__)
but that gives an error "identifier L__func__ is undefined"
__func__
is an implicitly declared identifier that expands to a character array variable containing the function name when it is used inside of a function. It was added to C in C99. From C99 §6.4.2.2/1:
The identifier
__func__
is implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declarationstatic const char __func__[] = "function-name";
appeared, where function-name is the name of the lexically-enclosing function. This name is the unadorned name of the function.
I take this to mean __func_ is not a macro and it has nothing to do with preprocessing?
Is there another way I can get a wchar_t array at compile time?