Development guide

Namespaces

Do not place using namespace in a header file or before an #include.
A source file must not define more than one namespace.
Do not use "using namespace". It causes excessive namespace pollution that may lead to subtle errors. Always be explicit and do not use "using namespace XYZ;". This is also valid for the std namespace. Do not use "using namespace std;".
Write namespace declarations in the following way:
  • one namespace declaration per line
  • the opening brace is on the line following the declaration
  • add a comment to the closing brace of the namespace
namespace ExampleNS 
{

class ClassName
{
...
};

} // End of namespace ExampleNS
namespace ExampleNS 
{

namespace XML 
{

class ClassName
{
...
};

} // End of namespace ExampleNS::XML
} // End of namespace ExampleNS
// Do not use:
using namespace ExampleNS;
ClassName object;

// Use:
ExampleNS::ClassName object;