0

Possible Duplicate:
Why is 'using namespace std;' considered a bad practice in C++?

I have done a little research and am looking for something close to the definitive answer on whether or not, as a farily new programmer (and very new to C++) I should get in the habit of including "using namespace std;" after my included libraries. OR do you guys recommend I start with identifying the scope everytime and use namespaces later? Namespaces now, namespaces later... The professor leaves it up to us and as our programs are fairly simple right now I don't know if it's too critical either way. I'd love to hear opinions. Thanks!

3
  • whatever you feel more comfortable with
    – littleadv
    Jan 9, 2012 at 10:52
  • 2
  • The important thing is, don't put using in your header files (at least, not in the global namespace) - that imposes it on users of the header, possibly breaking their code. Within a source file, it's more a matter of personal taste. Jan 9, 2012 at 11:45

1 Answer 1

2

Get in the habit of not using namespace std. It'll make your life easier when you start using lots of libraries with each their own namespace and potentially conflicting identifiers.

If you want to abbreviate, say, std::cout to cout, you can always declare

using std::cout;

Not the answer you're looking for? Browse other questions tagged or ask your own question.