Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!marob!daveh From: daveh@marob.masa.com (Dave Hammond) Newsgroups: comp.lang.c Subject: C preprocessor definition for current function name. Message-ID: <25DAF419.6B2@marob.masa.com> Date: 15 Feb 90 18:25:28 GMT Sender: daveh@marob.masa.com Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC, New York City Lines: 32 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@marob.masa.com uunet!masa.com!marob!daveh