Our friend Cylon tells us (##c++ @ freenode):
00:34 < exDM69_> !using namespace00:34 < nolyc> The use of using-directives (e.g. `using namespace std;') is discouraged, because: (1) in the case of namespace std, it potentially brings hundreds of names from the entire standard library into scope, and (2) their use obscures the origins of unqualified names in your code. Use explicit qualification (e.g. `std::cout') and/or using-declarations (e.g. `using std::cout;') instead.
Quote:Original post by Zahlman
The reason we use (that we *have*) namespaces, instead of tagging things manually with prefixes (thus foo::bar instead of foo_bar), is that we can omit the prefixes when there would be no ambiguity. Writing it every time makes things ugly, but you have to consider whether going too far the other way would make things difficult either for the compiler (by causing name collisions) or the reader (by making it hard to figure out where names come from).
Namespaces are a bit more than that (albeit nowhere near a real module system). Combined with Koenig lookup (search for function in the namespaces of their arguments) and some generic programming, namespaces have significant advantages over a plain old naming prefix. Good examples that use this are std::min and std::abs. (btw, you should always do using std::min; min(x); instead of std::min(x) if the code is in a template and x is of unknown type).
My guideline is as follows: I almost always do std::, quite often I do using boost::bind and sometimes even using namespace boost::lambda and I always do namespace po = boost::program_options when I encounter annoyingly long namespace names. I always try to stick with the innermost scope, and very seldom do anything outside a function-bound scope. I usually name my own namespaces with 3-5 letter names.
-Riku