Re: svn commit: r268491 - head/usr.bin/users
On Friday, July 11, 2014 3:38:16 pm David Chisnall wrote:
> On 11 Jul 2014, at 15:03, John Baldwin <jhb@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.
Agreed, I have used 'import Foo from Bar' in python as well.
> 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.
The original question was about a general style rule for C++ code in FreeBSD.
I suppose it would be fine to permit it in small utilities and only in .cc
files but not otherwise?
--
John Baldwin
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
討論串 (同標題文章)
完整討論串 (本文為第 24 之 30 篇):