quick question about std - efficiency

Started by
3 comments, last by NathanRunge 15 years, 12 months ago
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.
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.
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.
http://edropple.com
This should give you some more info.
Ahhh I read this thread title and was expecting some dubious replies. I've been on forums too long.

This topic is closed to new replies.

Advertisement