问题
Simlar question with LINE
But when I replaced __LINE__
with __FUNCTION__
.
Macro concat string literal "__FUNCTION__
" and not actual function name.
回答1:
__FUNCTION__
is not a macro, it's an implicitly declared static array. The same is true for __func__
, __PRETTY_FUNCTION__
, etc.
Thus #
can't work on it. If you want to concatenate something to it, you'll have to do that at runtime.
来源:https://stackoverflow.com/questions/65798613/stringizing-with-function-not-working