Stringizing with __FUNCTION__ not working

Viewed 430

Simlar question with LINE

But when I replaced __LINE__ with __FUNCTION__. Macro concat string literal "__FUNCTION__" and not actual function name.

1 Answers

__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, or with constexpr.

Related