Re: [eigen] Namespaces

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On Wednesday 10 October 2007, Benoît Jacob wrote:
> we initially used namespaces, but switched to prefixing recently. The
> reason is that namespace offer little protection as most users will want to
> be "using namespace". For instance look at the EiObject class. Without
> prefix, it'd be Object. A much too common name. If we encapsulate it in a
> namespace, it becomes Eigen::Object, which is safe, but... most users would
> like to "using namespace Eigen" and if some class is called "Object" then
> "using namespace" is not an option, because "Object" is a too polluting
> name.

In that case the compiler would return an error, it's hardly a problem.

> Look at what Qt does. Qt classes are not encapsulated in any namespace,
> instead they have the Q prefix, like "QObject".

Qt was first release at a time when namespaces were not well (if at all) 
supported by most C++ compiler.

-- 
Cyrille Berger



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/