preprocessor constant which names the current function (like __FILE__)

Dave Hammond daveh at marob.masa.com
Fri Feb 9 03:38:46 AEST 1990


I am constructing an error notification routine which outputs an error
code, the name of the C function which called the error routine, and an
error message.

The current interface requires the programmer to name the function, ie:

	Error(int errcode, char *function_name, ...)

It would save coding time (and make the interface simpler) if C provided
a compile-time method for determining the current function name.

Given that the C preprocessor definitions __FILE__ and __LINE__ specify
the current source module and line, is there an analagous definition for
the current source function (eg __FUNCTION__) ?

--
Dave Hammond
daveh at marob.masa.com
daveh at dsix2.uucp



More information about the Comp.lang.c mailing list