正在加载...
 
 登 录/注 册    帮助  |  反馈
目 标 :[ 目标剩余时间: ]
随便谈谈  什么都谈
杂糅并蓄  谈笑风生
    
作者
    Linux创始人:C++是一门恐怖的语言(C++ is a horrible language)   [2007-09-10]回复
专家用户
参与值:14755
贡献值:2574

Linux创始人Linus Torvalds在当地时间9月6号的一封邮件中这样说道,“C++是一门恐怖的语言,令它更加恐怖的是,许多不合规范的程序员使用它……”(C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it……)

Linus Torvalds接着说道,使用C++实在是很差劲的选择,最后你会发现无尽的痛苦和低下的效率……所有关于C++的优越性都是错误的言论。Linus Torvalds在文中极力推荐了C语言,他认为C是弃用C++的选择。

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 (3 days, 15 hours and 44 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
专家用户
参与值:12716
贡献值:1639
 X1936  2007-09-10 评论  引用

LINUS天才啊!

专家用户
参与值:14755
贡献值:2574
 catwork  2007-09-11 评论  引用

引用来自 X1936[09-10 22:44]

LINUS天才啊!

jgfjt
 jgfjt  2008-11-22 评论  引用

**匿名评论只有文章作者可以阅读**

专家用户
参与值:14755
贡献值:2574
 catwork  2008-11-25 评论  引用

引用来自 jgfjt[11-22 12:42]

Though I'm not a  programmer.You  ca

呵呵,我也是个新手的……

关于LINUX可以在ChinaUNIX看看

还有很多好的开源类杂志

PS:偶英语也很菜,都上面的话偶都不会in English……

    发表评论:

    ©2006-2008 深圳市海为信息技术有限公司  关于i170 | 工作机会 | 联系我们            粤ICP备05095695号