Why __func__, __FUNCTION__ and __PRETTY_FUNCTION__ aren’t preprocessor macros?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)