C: A Reference Manual, 5th Edition
Pages 23 and 24.
2.6.1 Predefined Identifiers
Although not a keyword, C99 introduces the concept of a
predefined identicier and defines
one such:
__func__. Unlike a predefined macro, a predefined identifier can follow nor-
mal block scoping rules. Like keywords, predefined identifiers must not be defined by
programmers.
The identifier
__func__ is implicitly declared by C99 implementations as if the
following declaration appeared after the opening brace of each function definition:
Code:
static const char __func__[] = "function-name";
This identifier could be used by debugging tools to peint out the name of the enclosing
function, as in:
Code:
if (failed) printf("Function %s failed\n", __func__ );
When translating C programs for targets with tight memory constraints, C implementa-
tions will have to be careful about getting rid of these strings if they are not needed at run-
time.