From owner-svn-src-all@FreeBSD.ORG Thu Jul 10 20:57:57 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 DD828462; Thu, 10 Jul 2014 20:57:57 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFCA223BC; Thu, 10 Jul 2014 20:57:57 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1X5LPf-000JBW-4k; Thu, 10 Jul 2014 20:57:55 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s6AKvpeX001035; Thu, 10 Jul 2014 14:57:51 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+CPLvaPV9tM2+fVhnRyj9B Subject: Re: svn commit: r268491 - head/usr.bin/users From: Ian Lepore To: John Baldwin In-Reply-To: <201407101127.42252.jhb@freebsd.org> References: <201407101215.s6ACF3v1055260@svn.freebsd.org> <201407101127.42252.jhb@freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Thu, 10 Jul 2014 14:57:51 -0600 Message-ID: <1405025871.51056.3.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Ed Schouten , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pietro Cerutti 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: Thu, 10 Jul 2014 20:57:58 -0000 On Thu, 2014-07-10 at 11:27 -0400, John Baldwin wrote: > On Thursday, July 10, 2014 11:04:56 am Ed Schouten wrote: > > On 10 July 2014 14:15, Pietro Cerutti wrote: > > > +using namespace std; > > > > Out of curiosity, do we have any style guidelines w.r.t. C++? For > > example, I would personally not use things like "using namespace std". > > It becomes hard to figure out where symbols come from. > > I would also prefer avoiding 'using namespace' when possible, especially for > a short program. > > > > + sort(begin(names), end(names)); > > > + vector::iterator last(unique(begin(names), end(names))); Seriously? We want this completely readable line changed to: std::vector::iterator last(std::unique( std::begin(names), std::end(names))); If so we REALLY need to revist the 80-column limitation. I think "using namespace std;" is enough of an idiom in C++ that it should be allowed and even encouraged unless there's a good reason not to use it. -- Ian > > This could also just be a std::set, right? > > > > Even though I actually think C++ is a lot nicer than C, do we really > > think it is actually worth proactively replacing already existent > > tools? This specific tool has now become three times as big as the > > previous version (7128 -> 23840 bytes). > > It'd be even shorter code (and a larger runtime footprint) to write it in > python. :) >