Charles R Harris wrote:
> On Tue, Feb 28, 2012 at 12:05 PM, John Hunter <jdh2358@gmail.com> wrote:
>>> On Sat, Feb 18, 2012 at 5:09 PM, David Cournapeau <cournape@gmail.com>wrote:
>>>>>>>> There are better languages than C++ that has most of the technical
>>>>>> benefits stated in this discussion (rust and D being the most
>>> "obvious" ones), but whose usage is unrealistic today for various
>>> reasons: knowledge, availability on "esoteric" platforms, etc… A new
>>> language is completely ridiculous.
>>>>>>>>> I just saw this for the first time today: Linus Torvalds on C++ (
>>http://harmful.cat-v.org/software/c++/linus). The post is from 2007 so
>> many of you may have seen it, but I thought it was entertainng enough and
>> on-topic enough with this thread that I'd share it in case you haven't.
>>>>>> The point he makes:
>>>> In other words, the only way to do good, efficient, and system-level and
>> portable C++ ends up to limit yourself to all the things that
>> are basically
>> available in C
>>>> was interesting to me because the best C++ library I have ever worked with
>> (agg) imports *nothing* except standard C libs (no standard template
>> library). In fact, the only includes external to external to itself
>> are math.h, stdlib.h, stdio.h, and string.h.
>>>> To shoehorn Jamie Zawinski's famous regex quote (
>>http://regex.info/blog/2006-09-15/247). "Some people, when confronted
>> with a problem, think “I know, I'll use boost.” Now they have two
>> problems."
>>>> Here is the Linus post:
>>>> From: Linus Torvalds <torvalds <at> linux-foundation.org>
>> Subject: Re: [RFC] Convert builin-mailinfo.c to use The Better String
>> Library.
>> Newsgroups: gmane.comp.version-control.git
>> Date: 2007-09-06 17:50:28 GMT (2 years, 14 weeks, 16 hours and 36 minutes
>> ago)
>>>> On Wed, 5 Sep 2007, Dmitry Kakurin wrote:
>> >
>> > When I first looked at Git source code two things struck me as odd:
>> > 1. Pure C as opposed to C++. No idea why. Please don't talk about
>> portability,
>> > it's BS.
>>>> *YOU* are full of bullshit.
>>>> C++ is a horrible language. It's made more horrible by the fact that a lot
>> of substandard programmers use it, to the point where it's much much
>> easier to generate total and utter crap with it. Quite frankly, even if
>> the choice of C were to do *nothing* but keep the C++ programmers out,
>> that in itself would be a huge reason to use C.
>>>> In other words: the choice of C is the only sane choice. I know Miles
>> Bader jokingly said "to piss you off", but it's actually true. I've come
>> to the conclusion that any programmer that would prefer the project to be
>> in C++ over C is likely a programmer that I really *would* prefer to piss
>> off, so that he doesn't come and screw up any project I'm involved with.
>>>> C++ leads to really really bad design choices. You invariably start using
>> the "nice" library features of the language like STL and Boost and other
>> total and utter crap, that may "help" you program, but causes:
>>>> - infinite amounts of pain when they don't work (and anybody who tells me
>> that STL and especially Boost are stable and portable is just so full
>> of BS that it's not even funny)
>>>> - inefficient abstracted programming models where two years down the road
>> you notice that some abstraction wasn't very efficient, but now all
>> your code depends on all the nice object models around it, and you
>> cannot fix it without rewriting your app.
>>>> In other words, the only way to do good, efficient, and system-level and
>> portable C++ ends up to limit yourself to all the things that are
>> basically available in C. And limiting your project to C means that people
>> don't screw that up, and also means that you get a lot of programmers that
>> do actually understand low-level issues and don't screw things up with any
>> idiotic "object model" crap.
>>>> So I'm sorry, but for something like git, where efficiency was a primary
>> objective, the "advantages" of C++ is just a huge mistake. The fact that
>> we also piss off people who cannot see that is just a big additional
>> advantage.
>>>> If you want a VCS that is written in C++, go play with Monotone. Really.
>> They use a "real database". They use "nice object-oriented libraries".
>> They use "nice C++ abstractions". And quite frankly, as a result of all
>> these design decisions that sound so appealing to some CS people, the end
>> result is a horrible and unmaintainable mess.
>>>> But I'm sure you'd like it more than git.
>>>>> Yeah, Linus doesn't like C++. No doubt that is in part because of the
> attempt to rewrite Linux in C++ back in the early 90's and the resulting
> compiler and portability problems. Linus also writes C like it was his
> native tongue, he likes to work close to the metal, and he'd probably
> prefer it over Python for most problems ;) Things have improved in the
> compiler department, and I think C++ really wasn't much of an improvement
> over C until templates and the STL came along. The boost smart pointers are
> also really nice. OTOH, it is really easy to write awful C++ because of the
> way inheritance and the other features were over-hyped and the 'everything
> and the kitchen sink' way it developed. Like any tool, familiarity and
> skill are essential to good results, but unlike some tools, one also needs
> to forgo some of the features to keep it under control. It's not a hammer,
> it is a three inch wide Swiss Army Knife.
>> Chuck
Much of Linus's complaints have to do with the use of c++ in the _kernel_.
These objections are quite different for an _application_. For example, there
are issues with the need for support libraries for exception handling. Not an
issue for an application.