svn commit: r268491 - head/usr.bin/users

David Chisnall theraven at FreeBSD.org
Fri Jul 11 19:38:40 UTC 2014


On 11 Jul 2014, at 15:03, John Baldwin <jhb at FreeBSD.org> wrote:

> 
> http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
> 
> is a decent start on the multitude of reasons to avoid using it.
> 
> I also avoid 'import * from foo' in Python for similar reasons.
> 
> OTOH, most of the C++ code bases I've had to work with do have a global
> 'using namespace std'.  Great fun when someone decides it would be
> convenient to add 'using namespace boost' to the mix.

Note that, even though 'using namespace std' is a bad idea, 'using std::vector; using std::string' and so on is not so bad. 

For things that live in the base system, there's not much danger of boost conflicts.  'using namespace std' is mostly a problem when it's in headers (especially library headers), because it can break large amounts of code.  In a tiny utility, it's probably the right thing to do.  

David



More information about the svn-src-all mailing list