A namespace is an ID space separator, where an ID can be a type, a variable,
or a function [unfortunately not a macro, but hey what can you do]. 

A using clause short-circuit the whole namespace and exposes all it's IDs
into the current namespace.  This is namespace cluttering, and is totally
against the purpose of separating ID into each name-space.

A use clause in a header is the worst, since this header now has a global
side effect.  This side effect makes it almost impossible to make include
ordering independent.  This is a serious restriction, since in many cases a
predefined include-order is conflicting with other requirements.

I hope this makes it more clear :)

- URS C. MUFF
SYSTEMS ARCHITECT       - RESEARCH LAB
[EMAIL PROTECTED]         - X6360
+1 (303) 894 3360


> -----Original Message-----
> From: Scot Nielsen [mailto:scotnielsen@;yahoo.co.uk]
> Sent: Tuesday, November 05, 2002 5:58 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Proposal Review: Using C++ Namespace
> 
> Hello Urs, being kind of new to namespaces and its usage I was intrigued
> to see your statement about not having a using namespace clause within a
> header file.
> 
> Would you mind expanding on why this is for a namespace newbie?
> 
> Thanks, Scot Nielsen
> 
> 
> -----Original Message-----
> From: Urs Muff [mailto:umuff@;quark.com]
> Sent: 04 November 2002 22:22
> To: '[EMAIL PROTECTED]'
> Subject: RE: Proposal Review: Using C++ Namespace
> 
> I couldn't agree more!  It's a very bad idea to have ANY using namespace
> clause in ANY header, since this goes completely against the point of
> namespaces in the first place.
> 
> - URS C. MUFF
> SYSTEMS ARCHITECT     - RESEARCH LAB
> [EMAIL PROTECTED]       - X6360
> +1 (303) 894 3360
> 
> 
> > -----Original Message-----
> > From: Samar Lotia [mailto:slotia@;siebel.com]
> > Sent: Monday, November 04, 2002 3:20 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: Proposal Review: Using C++ Namespace
> >
> > I would recommend against putting the 'using namespace xxx' in the
> header
> > file simply because you end up changing the symbol lookup rules for
> other
> > header files that follow you.
> >
> > For instance, if I had:
> >
> > #include "myheader.h"
> > #include "xerces_header.h"
> >
> > The compiler would not search the xerces namespace for symbols
> referenced
> > inline in myheader.h, whereas if I had:
> >
> > #include "xerces_header.h"
> > #include "myheader.h"
> >
> > Then the compiler would search the xerces namespace for symbols
> referenced
> > inline in myheader.h.
> >
> > This does not sound desirable.
> >
> > Seems each CPP should have to put the using namespace macro AFTER
> > including
> > all header files. Yes it does put the onus on the user, but IMHO is a
> > better
> > way of doing things.
> >
> > Case in point, none of the C++ standard headers include 'using
> namespace
> > std' in any header file. And these are things that are part of the C++
> > standard!
> >
> > My two cents...
> >
> > Samar Lotia
> >
> > -----Original Message-----
> > From: Tinny Ng [mailto:tng-xml@;ca.ibm.com]
> > Sent: Friday, November 01, 2002 5:58 PM
> > To: [EMAIL PROTECTED]
> > Subject: Proposal Review: Using C++ Namespace
> >
> >
> > Hi everyone,
> >
> > Based on many users' request, I've looked into the work of
> implementing
> > C++
> > namespace to Xerces-C++.
> >
> > I've reviewed the design in ICU, and also read suggestions from some
> old
> > threads (e.g. http://marc.theaimsgroup.com/?t=98019090000001&r=1&w=2,
> and
> > http://marc.theaimsgroup.com/?t=97119438300003&r=1&w=2), here is what
> I am
> > proposing:
> >
> > 1. Define the following macro in XercesDefs.hpp:
> >
> > //
> -----------------------------------------------------------------------
> > --
> > --
> > // Define namespace symbols if the compiler supports it.
> > //
> -----------------------------------------------------------------------
> > --
> > --
> > #if defined(XERCES_HAS_CPP_NAMESPACE)
> >     #define XERCES_CPP_NAMESPACE_BEGIN    namespace
> XERCES_CPP_NAMESPACE {
> >     #define XERCES_CPP_NAMESPACE_END    }
> >     #define XERCES_CPP_NAMESPACE_USE    using namespace
> > XERCES_CPP_NAMESPACE;
> >     #define XERCES_CPP_NAMESPACE_QUALIFIER    XERCES_CPP_NAMESPACE::
> >
> >     namespace XERCES_CPP_NAMESPACE { }
> >     namespace xercesc = XERCES_CPP_NAMESPACE;
> >     XERCES_CPP_NAMESPACE_USE
> > #else
> >     #define XERCES_CPP_NAMESPACE_BEGIN
> >     #define XERCES_CPP_NAMESPACE_END
> >     #define XERCES_CPP_NAMESPACE_USE
> >     #define XERCES_CPP_NAMESPACE_QUALIFIER
> > #endif
> >
> > 2. The XERCES_HAS_CPP_NAMESPACE is defined in each Compiler Definition
> > file,
> > e.g. xercesc/util/Compilers/GCCDefs.hpp
> >
> > //
> -----------------------------------------------------------------------
> > --
> > --
> > // Indicate that we support C++ namespace
> > // Do not define it if the compile cannot handle C++ namespace //
> >
> ------------------------------------------------------------------------
> -
> > --
> > //  #define XERCES_HAS_CPP_NAMESPACE
> >
> > 3.  And XERCES_CPP_NAMESPACE is defined in XercesVersion.hpp
> >     #define XERCES_PRODUCT    xercesc
> >     #define XERCES_CPP_NAMESPACE
> >
> INVK_CAT3_RAW_NUMERIC_SEP_UNDERSCORE(XERCES_PRODUCT,XERCES_VERSION_MAJOR
> ,X
> > ER
> > CES_VERSION_MINOR)
> >
> > where the INVK_CAT3... is an intermediate macro which will eventually
> > create
> > the namespace name "xercesc_2_1"
> >
> > 4. Then in each Xerces-C++ file (both .hpp and .cpp), add
> >     #define XERCES_CPP_NAMESPACE_BEGIN
> > at the beginning and
> >      #define XERCES_CPP_NAMESPACE_END
> > at the end
> >
> >
> >
> > Note:
> > 1.  "using namespace xercesc_2_1;" is coded in XercesDefs.hpp if
> > XERCES_HAS_CPP_NAMESPACE is defined.  So users are not required to
> modify
> > their application to pick up this support, unless they use forward
> > declaration which then need to be properly scoped.
> > 2.  The version number is included in the namespace name.   This is to
> > allow
> > co-existence of different Xerces-C++ releases on the same system.
> Such
> > idea is borrowed from ICU which seems working well.
> > 3.  And the distributed binary packages will then be built with C++
> > Namespace, wherever applicable
> >
> >
> > Any comment?
> >
> > Thanks!
> >
> > Tinny
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to