I am attempting to build a debug log message function that records the file, line, and function of of where the log message was called from.
#define DEBUG_P
I would like to add that the __FUNCTION__ macro is defined for both GCC and MSVC. Though non-standard, it is available on both compilers.
GCC Standard Predefined Macros quote:
C99 introduces
__func__, and GCC has provided__FUNCTION__for a long time. Both of these are strings containing the name of the current function (there are slight semantic differences; see the GCC manual). Neither of them is a macro; the preprocessor does not know the name of the current function. They tend to be useful in conjunction with__FILE__and__LINE__, though.
MSVC Predefined Macros quote:
__FUNCTION__Valid only in a function. Defines the undecorated name of the enclosing function as a string literal.
__FUNCTION__is not expanded if you use the /EP or /P compiler option.See
__FUNCDNAME__for an example.
So using __FUNCTION__ would be ok, since both compilers implement it. Though you may not get the same results on both compilers but that might be acceptable in some situations.