HP C A.06.05 Reference Manual

Program Organization
Lexical Elements
Chapter 2 11
Predefined identifier _func_
The HP ANSI C compiler defines the predefined identifier__func__, as specified in the C9X
Standard. This provides an additional means of debugging your code.
The use of the predefined "__func__" identifier allows you to use more informative debugging
statements to indicate a specific function. This is useful for fatal errors and conditions that
produce warnings. __func__ can also be used within debugging macros in order to keep track
of tasks such as the function calling stack, etc.
The __func__ identifier is implicitly declared by the compiler in the following manner:
static const char __func__[ ] = "<function-name>";
The declaration is implicitly added immediately after the opening brace of a function which
uses the variable __func__. The value <function-name> is the name of the
lexically-enclosing function.
The following code example fragment illustrates the use of the predefined identifier__func__.
Each time the varfunc function is called, it prints to the standard output stream:
varfunc
Keywords
HP C supports the following keywords. You cannot use keywords as identifiers; if you do, the
compiler reports an error. You cannot abbreviate a keyword, and you must enter keywords in
lowercase letters.
auto
break
case
char
const
continue
default
do
double
else