Jump to content
  • Advertisement
Sign in to follow this  
agm_ultimatex

quick question about std - efficiency

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I remember reading/hearing somewhere here that the line using namespace std; is best avoided, and its better to use std::cout, std::string, etc. Is this true? and if so, would you be able to explain? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
It has nothing to do with efficiency. You should never use a using directive or declaration in a header since that can change the meaning of subsequent code; however putting using namespace std in a source file after the headers is fine.

Share this post


Link to post
Share on other sites
Quote:
Original post by agm_ultimatex
I remember reading/hearing somewhere here that the line using namespace std; is best avoided, and its better to use std::cout, std::string, etc. Is this true? and if so, would you be able to explain? Thanks.
Using default namespaces makes for somewhat less readable code, in some people's estimation. It's not a question of efficiency, just cleanliness and readability. I don't subscribe to this notion for any language except C++; C++ needs all the help it can get to remain readable and clean.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!