C preprocessor definition for current function name.
Dave Hammond
daveh at marob.masa.com
Fri Feb 16 05:25:28 AEST 1990
Thanks to all those who responded to my query about a preprocessor
definition for the current function name. As a general rule, this can
not be done since the preprocessor is typically not integrated with the
C parser and has no understanding of C syntax or expressions.
Karl Heuer offered the most reasonable solution, which is to manually
update a constant at the entry to each function, ie:
#undef FUNCTION
#define FUNCTION "main"
main(void)
{
...
}
#undef FUNCTION
#define FUNCTION "foo"
foo(void)
{
...
}
In retrospect, I should apologize for wasting bandwidth with this
question, since I am well aware that my machine's C preprocessor is not
integrated with the compiler. Given a bit of thought before posting, I
would have answered my own question.
--
Dave Hammond
daveh at marob.masa.com
uunet!masa.com!marob!daveh
More information about the Comp.lang.c
mailing list