Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Don't use the `using {{using namespace ...` }} or `using using ...` constructs in a header file. It might save you some typing but it also forces the namespaces you use onto every `.cpp` cpp file that directly or indirectly includes your headers. That could create name clashes with names in some other namespace that the author of the `.cpp` cpp file wants to use. Use fully qualified names, painful as it might be.

There is one exception. It's sometimes handy to "import" names from one namespace to another. For example suppose some C++ compiler doesn't provide the `stdstd::tr1::auto_ptr` ptr template, which is used in qpid. Boost does provide a compatible `boostboost::auto_ptr` ptr but it's in the boost namespace and qpid expects it in `stdstd::tr1`tr1. No problem, we create our own tr1/memory header file:

...