Special Token __FUNCTION__
Byron Heads
wyverex.cypher at gmail.com
Mon Sep 7 09:41:46 PDT 2009
I've looked through the lex documents but there seems to be no special token
to get the current calling function.
In c you can use the __func__ token to get the current function.
I thinking adding __FUNCTION__ would be useful for things like logging.
Also is there a nice way to replace logging macros? I often have a logger
that looks like
logmsg( int level, uint line, char* func, char* file, char[] msg, ... );
then I would write some macros like:
#define LOGDEBUG( m, ... ) logmsg( LVL_DEBUG, __LINE__, __func__, __FILE__, msg, __VA_ARGS__ )
thus i would only have to do
LOGDEBUG( "SOME STRING with formatting", formatting args.. )
-B
More information about the Digitalmars-d
mailing list