T
Torsten Wiebesiek
Hi,
I have a problem with the preprocessor. I have written my own little
assert macro. This is supposed to log a message (with log4cxx):
#define LogAssert(Expression) \
if (Expression) { \
LOG4CXX_FATAL(log4cxx::Logger::getRootLogger(), "LogAssert: " \
#Expression " in file " __FILE__ ", line " #__LINE__ "."); \
::exit(1); \
}
Unfortunately, the preprocessor is only quoting marcro arguments. In my
case, Expression is quoted with #Expression. __LINE__ expands to an
integer literal. Is there an way to convert __LINE__ to a const char* at
compile time?
Thanks for you help,
Torsten
I have a problem with the preprocessor. I have written my own little
assert macro. This is supposed to log a message (with log4cxx):
#define LogAssert(Expression) \
if (Expression) { \
LOG4CXX_FATAL(log4cxx::Logger::getRootLogger(), "LogAssert: " \
#Expression " in file " __FILE__ ", line " #__LINE__ "."); \
::exit(1); \
}
Unfortunately, the preprocessor is only quoting marcro arguments. In my
case, Expression is quoted with #Expression. __LINE__ expands to an
integer literal. Is there an way to convert __LINE__ to a const char* at
compile time?
Thanks for you help,
Torsten