[webkit-dev] WTFNoncopyable namespace and ADL

Chris Jerdonek chris.jerdonek at gmail.com
Sun Nov 8 00:21:47 PST 2009


I have a question regarding JSC's WTFNoncopyable::Noncopyable class
and argument-dependent lookup (ADL).  It seems like an old decision
may have been unintentionally undone in changeset 46933 (first
attempted in 46877).

The Noncopyable class (currently JavaScriptCore/wtf/Noncopyable.h) was
originally added in Feb 2006 with the following comment:

// We don't want argument-dependent lookup to pull in everything
// from the KXMLCore [now WTF] namespace when you use Noncopyable,
// so put it in its own namespace.

namespace KXMLCoreNoncopyable {

    class Noncopyable {

( http://trac.webkit.org/changeset/12523/trunk/JavaScriptCore/kxmlcore/Noncopyable.h
)

Then, in changeset 46933 (August 2009), the class declaration was changed to--

namespace WTFNoncopyable {

-    class Noncopyable {
+    class Noncopyable : public FastAllocBase {

( http://trac.webkit.org/changeset/46933/trunk/JavaScriptCore/wtf/Noncopyable.h
)

But FastAllocBase is in the WTF namespace, defeating the aim of the commenter.

It seems like either the WTFNoncopyable namespace should be changed to
WTF and the comment removed, or else FastAllocBase should be put into
its own namespace as well (or something equivalent).  I'm not sure how
important it is to preserve the original ADL behavior.

--Chris


More information about the webkit-dev mailing list