I\'ve just noticed that __func__
, __FUNCTION__
and __PRETTY_FUNCTION__
aren\'t treated as preprocessor macros and they\'re not mention
Expanding __func__
at preprocessing time requires the preprocessor to know which function it's processing. The preprocessor generally doesn't know that, because parsing happens after the preprocessor is already done.
Some implementations combine the preprocessing and the parsing, and in those implementations, it would have been possible for __func__
to work the way you'd like it to. In fact, if I recall correctly, MSVC's __FUNCTION__
works like that. It's an unreasonable demand on implementations that separate the phases of translation though.