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

Hans Ottevanger hans at beastielabs.net
Sun Jul 13 13:59:34 UTC 2014


On 07/12/14 15:27, Alexey Dokuchaev wrote:
> On Sat, Jul 12, 2014 at 01:37:49PM +0100, Bruce Simpson wrote:
>> On 12/07/2014 12:34, Bruce Evans wrote:
>>> This joke is bad.  The C++ version is worse in every way.
>>
>> I concur with everything you have said in your message. Moral of story: it
>> is very, very easy to introduce bloat using C++, and using a higher level
>> language does not automatically lead to better code quality.
> 
> +1.  Now the question is, how do we come out of this mess?  Shall we redo
> it in C again?  Polish C++ version?  Merge it with w(1) as suggested?
> 

Concerning the commit itself, I don't have much to add to the comments
by Bruce Evans.

More in general, in my experience C++ is not that suitable as a language
for this kind of small utilities, where you do not need its abstraction
facilities. This could be the reason why the original C version was as
good as and (if polished a bit) even better (clearer) than the C++ version.

Additionally, one of the properties of a code tree that influences
quality is uniformity. Rewriting random small C utilities that work
perfectly well in C++ breaks uniformity.

Before being accused of hating C++, I like to mention that I have been
involved for quite a few years in several HPC projects that use C++, but
there you actually need the abstraction facilities.

I can imagine that some selected utilities (or groups of utilities that
share abstractions) that are difficult to maintain when written in C are
rewritten in C++, but some discussion in current@ or hackers@ beforehand
might be in order.

Regards,

Hans


More information about the svn-src-head mailing list