Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
0.9.7
-
None
-
None
Description
On Apr 11, 2006, at 4:13 AM, Ondrej Pacovsky wrote:
Hi, I'd just like to note that the LOG4CXX_ASSERT macro might be a bit dangerous because of its usage of the "condition" param:
#define LOG4CXX_ASSERT(logger, condition, message) { \
if (!condition && logger->isErrorEnabled()) {\
logger->forcedLog(::log4cxx::Level::getError(), message, LOG4CXX_LOCATION); }}
when used e.g. as LOG4CXX_ASSERT(lmain, false || true, "damn"), it producess the error message when it shouldn't.
FIX: use parentheses
#define LOG4CXX_ASSERT(logger, condition, message) { \
if (!(condition) && logger->isErrorEnabled()) {\
logger->forcedLog(::log4cxx::Level::getError(), message, LOG4CXX_LOCATION); }}
cheers,
Ondrej