Linus vs C++

大牛Linus在骂C++,这人脾气也太火爆了...如此看来回去把C++仍了吧...
我觉得C++ STL挺好用的啊...OK, I am a substandard programmer...
http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918

From: Linus Torvalds 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 (16 weeks, 12 hours and 4 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.

Linus



随机文章:

5 Comments

  1. narkau 2007-12-28,7:49 下午

    没看懂..

  2. narkau 2007-12-28,7:52 下午

    Unix你了解多吗,,,,kiss,,,,:-)

  3. 小班 2007-12-28,10:38 下午

    我宣布我看不懂~~~ :twisted:

  4. 凡龙 2007-12-31,10:34 上午

    本来C++就未必是个好的编程语言,是个C语言和OO思想调和的产物。C语言本身是个干净而原始的语言,它本身就是为了OS而存在的。然而多了两个加号‘+’,就逐渐向垃圾语言迈進了,一切都变得过于复杂和难于理解。想当年哥哥我是C++的高手呢,相当的崇拜这门语言。后来随着经验的增长,发现比这个东西高明的语言多的是,Delphi、Java、C#、纯C。Linux之父用C而不用C++开发Linux,那是可以理解的,因为最简单、最纯净就是最好。

  5. 凡龙 2007-12-31,10:50 上午

    凡龙建议:学习C呢,一定要和跨平台相联系,这样对于将来的Job Hunting很有好处。原本C语言就来源于Unix,是Unix的产物,所以有条件的话,学习C语言最好要结合Unix(Linux),在Unix(Linux)做C开发,这才是原汁原味的C语言。如果真的像市面上那样,弄一个《深入浅出MFC》在那儿猛钻,就走入误区了。那些STL、第三方的Framework也只是看看即可,不必钻太深。那些黄金外企,例如Google、AutoDesk都比较需要C程序员。

Add a Comment