I have been told by many programmers that having a using namespace <x>
statement in a header file is a bad idea. I have been following this advice blindly till now without understanding why is it so. Now that I am working on a very complex project with lots of namespaces. At times I find it too tempting to tell the compiler about the namespace in the beginning rather than having to type nested ::'s everytime. Example:
ALongNameSpaceName::LongerNamespaceName::BasicUtilityFunctionUsedVeryCommonly
What is the rationale behind this rule? In what scenarios can I ignore this rule?