BIND 10 trac899, updated. c24dd6f877460227e6eed02d0cca0956366748cb [trac899] Initialise member variable before running constructor
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 31 11:25:05 UTC 2011
The branch, trac899 has been updated
via c24dd6f877460227e6eed02d0cca0956366748cb (commit)
from dc44fdda4e0705993f44275d22b2daa45d4bae6f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c24dd6f877460227e6eed02d0cca0956366748cb
Author: Stephen Morris <stephen at isc.org>
Date: Tue May 31 12:22:29 2011 +0100
[trac899] Initialise member variable before running constructor
The FreeBSD compiler complained that the member variable logger_
could not be constructed because the data type (log4cplus::Logger)
has no default constructor. It is therefore initialized to point
to the log4cplus root logger (the one that is guaranteed to exist),
even though the LoggerImpl constructor may reset it immediately
afterwards.
-----------------------------------------------------------------------
Summary of changes:
src/lib/log/logger_impl.cc | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc
index 3cbfb6b..46a3a13 100644
--- a/src/lib/log/logger_impl.cc
+++ b/src/lib/log/logger_impl.cc
@@ -42,8 +42,12 @@ using namespace std;
namespace isc {
namespace log {
-// Constructor
-LoggerImpl::LoggerImpl(const string& name)
+// Constructor. Although it may be immediately reset, logger_ is initialized to
+// the log4cplus root logger; at least one compiler requires that all member
+// variables be constructed before the constructor is run, but log4cplus::Logger
+// (the type of logger_) has no default constructor.
+LoggerImpl::LoggerImpl(const string& name) :
+ logger_(log4cplus::Logger::getRoot())
{
// Initialize log4cplus if not already done
initLog4cplus();
@@ -51,7 +55,7 @@ LoggerImpl::LoggerImpl(const string& name)
// Are we the root logger?
if (name == getRootLoggerName()) {
name_ = name;
- logger_ = log4cplus::Logger::getRoot();
+ // logger_ already set to log4cplus root logger at this point
} else {
name_ = getRootLoggerName() + "." + name;
More information about the bind10-changes
mailing list