From owner-svn-src-all@FreeBSD.ORG Fri Jul 11 21:26:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B293EEE; Fri, 11 Jul 2014 21:26:34 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 117AC28A1; Fri, 11 Jul 2014 21:26:34 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 463AFB93A; Fri, 11 Jul 2014 17:26:32 -0400 (EDT) From: John Baldwin To: David Chisnall Subject: Re: svn commit: r268491 - head/usr.bin/users Date: Fri, 11 Jul 2014 17:26:14 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201407101215.s6ACF3v1055260@svn.freebsd.org> <201407111003.57785.jhb@freebsd.org> <12328E44-58A8-4334-A7F4-C7F29C9F6D0E@FreeBSD.org> In-Reply-To: <12328E44-58A8-4334-A7F4-C7F29C9F6D0E@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201407111726.14347.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 11 Jul 2014 17:26:32 -0400 (EDT) Cc: Ed Schouten , src-committers@freebsd.org, Ian Lepore , svn-src-all@freebsd.org, Pietro Cerutti , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jul 2014 21:26:34 -0000 On Friday, July 11, 2014 3:38:16 pm David Chisnall wrote: > On 11 Jul 2014, at 15:03, John Baldwin 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