From owner-svn-src-head@FreeBSD.ORG Thu Jul 10 15:04:57 2014 Return-Path: Delivered-To: svn-src-head@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 D8D2A425; Thu, 10 Jul 2014 15:04:57 +0000 (UTC) Received: from mail-vc0-x229.google.com (mail-vc0-x229.google.com [IPv6:2607:f8b0:400c:c03::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51D9623DE; Thu, 10 Jul 2014 15:04:57 +0000 (UTC) Received: by mail-vc0-f169.google.com with SMTP id la4so11031090vcb.0 for ; Thu, 10 Jul 2014 08:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=PPqifpsDul4cAnSTmZFuUsc8xl/FCld34S3MRRxJHjc=; b=IBYkZmOHOGQmvXcW1vGB8ohA6to/zlm2nRPXM4b10zkeVR1Zpw0+tENs+HyTJdRnw+ bjAAUp+VymjZR5DqTdoIGBtXUP/zW7BR4CTXMinNAnvd8TgnRr74b7zRJNKS0n1DvR+F dpfvjGePDPFwzntwMYOHQ7NLfRQ3HvY0r7961Qv0olQVWT5Arl9y5BlelLrxedC+56sx CKBHKsQx5nyK4hEOyI1H2lCXotAxHnDhh8UWJLYIZSV3XpfiLuvNqj4nIVofXo8rbhAE hyRUz1vP8053CSW9eZorF3sTlsp5Q+s/vJJxdHE86ZMxbvufn9tdqXRR7jbmSoGV7m9q 0qaw== MIME-Version: 1.0 X-Received: by 10.52.52.167 with SMTP id u7mr505879vdo.70.1405004696158; Thu, 10 Jul 2014 08:04:56 -0700 (PDT) Sender: edschouten@gmail.com Received: by 10.58.100.233 with HTTP; Thu, 10 Jul 2014 08:04:56 -0700 (PDT) In-Reply-To: <201407101215.s6ACF3v1055260@svn.freebsd.org> References: <201407101215.s6ACF3v1055260@svn.freebsd.org> Date: Thu, 10 Jul 2014 17:04:56 +0200 X-Google-Sender-Auth: YwEkCNJGIRVVyMObxYBhcPNOBTM Message-ID: Subject: Re: svn commit: r268491 - head/usr.bin/users From: Ed Schouten To: Pietro Cerutti Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2014 15:04:57 -0000 Hi there, On 10 July 2014 14:15, Pietro Cerutti wrote: > Reimplements users(1) in C++. > > This reduces the lines of code by roughly 50% (not counting the COPYRIGHT > header) and makes it more readable by using standard algorithms. Interesting. More C++ in our base system. :-) > Modified: head/usr.bin/users/Makefile > ============================================================================== > --- head/usr.bin/users/Makefile Thu Jul 10 11:20:24 2014 (r268490) > +++ head/usr.bin/users/Makefile Thu Jul 10 12:15:02 2014 (r268491) > @@ -1,6 +1,7 @@ > # @(#)Makefile 8.1 (Berkeley) 6/6/93 > # $FreeBSD$ > > -PROG= users > +WARNS= 3 > +PROG_CXX= users > > .include Why does this require WARNS to be set to 3? For brand new code, I would have expected that it would just build with WARNS=6. > +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. > + sort(begin(names), end(names)); > + vector::iterator last(unique(begin(names), end(names))); 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). -- Ed Schouten