Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2014 17:04:56 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Pietro Cerutti <gahr@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r268491 - head/usr.bin/users
Message-ID:  <CAJOYFBCQjjN7ep12zivnmFjfeeP1SeoYa963mQbMJr9DD%2BfUnw@mail.gmail.com>
In-Reply-To: <201407101215.s6ACF3v1055260@svn.freebsd.org>
References:  <201407101215.s6ACF3v1055260@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi there,

On 10 July 2014 14:15, Pietro Cerutti <gahr@freebsd.org> 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 <bsd.prog.mk>

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<string>::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 <ed@80386.nl>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJOYFBCQjjN7ep12zivnmFjfeeP1SeoYa963mQbMJr9DD%2BfUnw>