[Orxonox-commit 1415] r6133 - code/branches/presentation2/src/libraries/util
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Nov 23 23:29:02 CET 2009
Author: rgrieder
Date: 2009-11-23 23:29:01 +0100 (Mon, 23 Nov 2009)
New Revision: 6133
Modified:
code/branches/presentation2/src/libraries/util/Debug.h
Log:
Removed annoying "statement has no effect" warning (gcc).
Modified: code/branches/presentation2/src/libraries/util/Debug.h
===================================================================
--- code/branches/presentation2/src/libraries/util/Debug.h 2009-11-23 21:31:12 UTC (rev 6132)
+++ code/branches/presentation2/src/libraries/util/Debug.h 2009-11-23 22:29:01 UTC (rev 6133)
@@ -72,12 +72,22 @@
//! Adjust to discard certain output with level > hardDebugLevel at compile time
const int hardDebugLevel = OutputLevel::Verbose;
+
+ //! This function simply returns 0 and helps to suppress the "statement has no effect" compiler warning
+ inline int debugDummyFunction()
+ {
+ return 0;
+ }
}
/**
@brief
Logs text output: use exactly like std::cout, but specify an output
level as argument.
+ at details
+ (a > b ? 0 : c << "text") is equivalent to (a > b ? 0 : (c << "text"))
+ where (a > b ? 0 : ) stands for COUT(x). This should explain how
+ this macro magic can possibly even work ;)
@example
COUT(3) << "Some info" << std::endl;
@note
@@ -87,10 +97,10 @@
*/
#define COUT(level) \
/*if*/ (level > orxonox::hardDebugLevel) ? \
- 0 \
+ orxonox::debugDummyFunction() \
/*else*/ : \
/*if*/ (level > orxonox::OutputHandler::getSoftDebugLevel()) ? \
- 0 \
+ orxonox::debugDummyFunction() \
/*else*/ : \
orxonox::OutputHandler::getOutStream(level)
More information about the Orxonox-commit
mailing list