Rule Definition
The 'using namespace' directive pulls an entire namespace into not only your header, but also any client code that uses your header. This can provoke ambiguities in client code, or even select the wrong function during overload resolution.
A namespace 'using' declaration is not as polluting, but can have strange side effects since it only captures function overload sets at the time it appears.
Using 'using' is a very valuable way to increase code brevity in implementation files (.cpp), but should be avoided in headers files.
Remediation
In header files, always explicitly qualify names from other namespaces.
Violation Code Sample
// In header
#include <string>
#include <vector>
using namespace std;
vector<string> split(string const &s);
Fixed Code Sample
// In header
#include <string>
#include <vector>
using namespace std;
std::vector<std::string> split(std::string const &s);
Reference
C++ coding standard, Sutter/Alexandrescu, Item 59 (http://www.gotw.ca/publications/c++cs.htm)
Related Technologies
C++
Technical Criterion
Programming Practices - Modularity and OO Encapsulation Conformity
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.