Re: svn commit: r268491 - head/usr.bin/users

2014-07-15 Thread Pietro Cerutti
On 2014-Jul-10, 11:27, John Baldwin wrote: I would also prefer avoiding 'using namespace' when possible, especially for a short program. On 2014-Jul-11, 17:26, John Baldwin wrote: I suppose it would be fine to permit it in small utilities and only in .cc files but not otherwise? I'm

Re: svn commit: r268491 - head/usr.bin/users

2014-07-15 Thread John Baldwin
On Tuesday, July 15, 2014 3:21:49 pm Pietro Cerutti wrote: On 2014-Jul-10, 11:27, John Baldwin wrote: I would also prefer avoiding 'using namespace' when possible, especially for a short program. On 2014-Jul-11, 17:26, John Baldwin wrote: I suppose it would be fine to permit it in small

Re: svn commit: r268491 - head/usr.bin/users

2014-07-12 Thread David Chisnall
On 11 Jul 2014, at 22:26, John Baldwin j...@freebsd.org wrote: 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

Re: svn commit: r268491 - head/usr.bin/users

2014-07-12 Thread David Chisnall
On 10 Jul 2014, at 16:29, Ed Schouten e...@80386.nl wrote: With the patch above, the binary shrinks to 15640 bytes, so my concerns are somewhat addressed. :-) I wasn't seeing that saving, but I've now committed a tweak to the Makefile that turns off exceptions and RTTI. This shrinks the

Re: svn commit: r268491 - head/usr.bin/users

2014-07-12 Thread Dimitry Andric
On 10 Jul 2014, at 17:29, Ed Schouten e...@80386.nl wrote: On 10 July 2014 17:23, Pietro Cerutti g...@freebsd.org wrote: It's because of the standard library. Examples: /usr/include/c++/v1/memory:1454:47: error: unused parameter '__a' [-Werror,-Wunused-parameter] static void

Re: svn commit: r268491 - head/usr.bin/users

2014-07-12 Thread Jilles Tjoelker
On Sat, Jul 12, 2014 at 11:06:33PM +0200, Dimitry Andric wrote: On 10 Jul 2014, at 17:29, Ed Schouten e...@80386.nl wrote: On 10 July 2014 17:23, Pietro Cerutti g...@freebsd.org wrote: It's because of the standard library. Examples: /usr/include/c++/v1/memory:1454:47: error: unused

Re: svn commit: r268491 - head/usr.bin/users

2014-07-11 Thread Gleb Smirnoff
On 10 July 2014 14:15, Pietro Cerutti g...@freebsd.org wrote: Reimplements users(1) in C++. AFAIU, functionality of users(1) is subset of w(1). Is it possible to create one binary for both, installing them hardlinked? -- Totus tuus, Glebius. ___

Re: svn commit: r268491 - head/usr.bin/users

2014-07-11 Thread John Baldwin
On Thursday, July 10, 2014 4:57:51 pm Ian Lepore wrote: 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 g...@freebsd.org wrote: +using namespace std; Out of curiosity, do we have

Re: svn commit: r268491 - head/usr.bin/users

2014-07-11 Thread David Chisnall
On 11 Jul 2014, at 15:03, John Baldwin j...@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.

Re: svn commit: r268491 - head/usr.bin/users

2014-07-11 Thread John Baldwin
On Friday, July 11, 2014 3:38:16 pm David Chisnall wrote: On 11 Jul 2014, at 15:03, John Baldwin j...@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.

svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Pietro Cerutti
Author: gahr (ports committer) Date: Thu Jul 10 12:15:02 2014 New Revision: 268491 URL: http://svnweb.freebsd.org/changeset/base/268491 Log: 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

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Ed Schouten
Hi there, On 10 July 2014 14:15, Pietro Cerutti g...@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. :-)

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Pietro Cerutti
On 2014-Jul-10, 17:04, Ed Schouten wrote: Hi there, On 10 July 2014 14:15, Pietro Cerutti g...@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

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Ed Schouten
On 10 July 2014 17:23, Pietro Cerutti g...@freebsd.org wrote: It's because of the standard library. Examples: /usr/include/c++/v1/memory:1454:47: error: unused parameter '__a' [-Werror,-Wunused-parameter] static void construct(allocator_type __a, _Tp* __p)

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Pietro Cerutti
On 2014-Jul-10, 17:29, Ed Schouten wrote: On 10 July 2014 17:23, Pietro Cerutti g...@freebsd.org wrote: It's because of the standard library. Examples: /usr/include/c++/v1/memory:1454:47: error: unused parameter '__a' [-Werror,-Wunused-parameter] static void

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Baptiste Daroussin
On Thu, Jul 10, 2014 at 05:42:13PM +0200, Pietro Cerutti wrote: On 2014-Jul-10, 17:29, Ed Schouten wrote: On 10 July 2014 17:23, Pietro Cerutti g...@freebsd.org wrote: It's because of the standard library. Examples: /usr/include/c++/v1/memory:1454:47: error: unused parameter '__a'

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Ed Schouten
On 10 July 2014 17:53, Baptiste Daroussin b...@freebsd.org wrote: Just make sure not to break mips, powerpc and sparc64 which are still using gcc 4.2 :) Oomf! Good point. Completely forgot about that. There is indeed one C++11-ism in the code, namely the use of auto. Let me fix that. -- Ed

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Pietro Cerutti
On 2014-Jul-10, 17:57, Ed Schouten wrote: On 10 July 2014 17:53, Baptiste Daroussin b...@freebsd.org wrote: Just make sure not to break mips, powerpc and sparc64 which are still using gcc 4.2 :) Oomf! Good point. Completely forgot about that. There is indeed one C++11-ism in the code,

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Ed Schouten
On 10 July 2014 18:05, Pietro Cerutti g...@freebsd.org wrote: I reply to this one, since I'm not on src-all. - for consistency, I'd s|std::set|set| - return (0) is not needed in c++ Good catch. Fixed! -- Ed Schouten e...@80386.nl ___

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread John Baldwin
On Thursday, July 10, 2014 11:04:56 am Ed Schouten wrote: On 10 July 2014 14:15, Pietro Cerutti g...@freebsd.org 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

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Nathan Whitehorn
On 07/10/14 08:57, Ed Schouten wrote: On 10 July 2014 17:53, Baptiste Daroussin b...@freebsd.org wrote: Just make sure not to break mips, powerpc and sparc64 which are still using gcc 4.2 :) Oomf! Good point. Completely forgot about that. There is indeed one C++11-ism in the code, namely the

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Adrian Chadd
... I think this particular commit highlights our almost complete lack of useful data types in our C libraries. I think it's about time we grew a similar list of basic DSAs. I had to reimplement hash tables, trees and callwheels at work recently. Ugh. -a On 10 July 2014 09:59, Nathan

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread David Chisnall
On 10 Jul 2014, at 18:13, Adrian Chadd adr...@freebsd.org wrote: ... I think this particular commit highlights our almost complete lack of useful data types in our C libraries. I think it's about time we grew a similar list of basic DSAs. I had to reimplement hash tables, trees and

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Pietro Cerutti
On 2014-Jul-10, 10:13, Adrian Chadd wrote: ... I think this particular commit highlights our almost complete lack of useful data types in our C libraries. I think it's about time we grew a similar list of basic DSAs. We do have STL. Let's just use it. I had to reimplement hash tables,

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Ian Lepore
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 g...@freebsd.org wrote: +using namespace std; Out of curiosity, do we have any style guidelines w.r.t. C++? For example, I would

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Adrian Chadd
On 10 July 2014 10:38, Pietro Cerutti g...@freebsd.org wrote: On 2014-Jul-10, 10:13, Adrian Chadd wrote: ... I think this particular commit highlights our almost complete lack of useful data types in our C libraries. I think it's about time we grew a similar list of basic DSAs. We do have

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Jordan Hubbard
On Jul 10, 2014, at 10:20 AM, David Chisnall david.chisn...@cl.cam.ac.uk wrote: This is important in a wider context. For example, in the project to add machine-readable output to core utilities, we'd like to be able to parse these into the same machine-readable format. Apple has the

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Juli Mallett
On Thu, Jul 10, 2014 at 9:11 AM, Ed Schouten e...@80386.nl wrote: On 10 July 2014 18:05, Pietro Cerutti g...@freebsd.org wrote: I reply to this one, since I'm not on src-all. - for consistency, I'd s|std::set|set| - return (0) is not needed in c++ Good catch. Fixed! If we're going to

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Baptiste Daroussin
On Thu, Jul 10, 2014 at 01:26:18PM -0700, Jordan Hubbard wrote: On Jul 10, 2014, at 10:20 AM, David Chisnall david.chisn...@cl.cam.ac.uk wrote: This is important in a wider context. For example, in the project to add machine-readable output to core utilities, we'd like to be able to

Re: svn commit: r268491 - head/usr.bin/users

2014-07-10 Thread Alexey Dokuchaev
On Thu, Jul 10, 2014 at 05:57:37PM +0200, Ed Schouten wrote: On 10 July 2014 17:53, Baptiste Daroussin b...@freebsd.org wrote: Just make sure not to break mips, powerpc and sparc64 which are still using gcc 4.2 :) Oomf! Good point. Completely forgot about that. There is indeed one