| |||
| 这里没人吵架,就看看别人吵架算了。老家伙够固执的……(不知道他多大,不过看这个样子觉得像是个老家伙 )不过我也觉得C写出来的东西貌似是比某些C++干净不少,但也罗嗦不少。 Gmane Loom 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 (17 hours and 46 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 此帖于 2007-09-07 10:31 PM 被 cat 编辑. |
| |||
| 同意,不过有些语言一旦编译通过代码就不会太难懂或者容易隐藏那些tricky的bug. 那边吵架的人某一个说C提供了“正确”的抽象,不多也不少,code不太难写也不至于太容易出错。我觉得这个说法很有意思,不过平时写code我还是觉得C的抽象能力稍微低了点,不是最爽;C++又太多了。 BTW大学的时候有一个作业说要看了一把linux的kernel的调度什么的code, 写得实在不怎么好懂而且几乎没有注释…… sigh 不敢恭维啊…… 此帖于 2007-09-08 12:33 PM 被 cat 编辑. |
| ||||
| 我觉得这还是和语言的特长有关,Linus需要的system-level的代码可能用C++是不如C高效简洁,C++主要的优势是比其他语言高效的面向对象能力,而OO在设计系统级代码里一直都不吃香。 至于Linus说的什么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.让人觉得他就是BS说的把C++当C用的人,鉴于大多数搞Unix大牛向来把C++贬低到除了兼容C就没有其他优点的地步,倒也不让人觉得奇怪。 我的看法:C++最大的弱点是复杂的语法的“光芒”很容易掩盖本身的语意的重要性,某些特性(比如GP)很难在实践中应用(比起Lisp差的不是那么一点半点,最近看SICP有感),各种GP库还是很酷而且很有用,但是调试起来超麻烦。最近的0x看起来又要增加一些比较炫的能力,但是成型后估计要成为一个超级庞然大物,和最近语言越来越简化的趋势有点背道而驰。 C++最大的优势是:OO与效率并重?...我觉得是学了C++后,再学其他什么语言都感觉是小菜一碟 ![]() |
| |||
| 也许有人早就贴过了,也许并不太准确 TIOBE Software - The Coding Standards Company |
| |||
| 搞Java的人,整天就摇头晃脑地琢磨封装啊,抽象啊,对接口编程啊,依赖注射呀这些高来高去虚头八脑的东西。(对,咱没有ruby/python的closure/lamdba,string interpolation等等花拳绣腿,但是我们可以和蔼慈祥地正告他们,你们那个东西慢的一塌糊涂,小孩子过家家的东西也拿来显?一边儿玩儿去吧,别淘气啊。)最烦的就是cpper象蚊子一样地“效率, 效率”地念经。我们无数次地忍无可忍歇斯底里地大喊:java已经不比c++慢了,有些地方我们还可以超过你们啦,啦,啦!!!! 可是,不知道是我们的声音不够振聋发聩还是你们故意装作听不见,还是总有cpper继续象蚊子一样地在耳边墨迹:“效率,效率,效率”。真是有种秀才遇见兵的无助感啊。 哈哈。这下好了。linus骂的这叫一个痛快,读linus的文章我可是一行一行文字反复地咀嚼,品味,那行文如天马行空,潇洒恣肆,眼前不禁蹭蹭蹭闪过许多英雄形象来(啊,说错了,是文学作品中意气风发,指点江山,口沫横飞的北京小痞子形象)。读后也是唇齿留香,回味无穷啊。小样儿的,你也有今天?遭报应了吧?知道啥叫小人得志不?知道啥叫落井下石不?不知道?那今天大爷就让你知道知道。hia, hia hia! ![]() |
| |||
| 感觉这linus怎么抄袭我的观点呢?这 引用:
我当时还强烈推荐一种设计方式:ajoo c++。 就是不要用拷贝构造函数和析构函数(只用scope guard)。对象拷贝都是bit copy。对象也不自动对资源拥有所有权和释放权。 这两样,加上如果c++的template不是现在这样搞的一团糟的话,就足以拯救c++了。看看linus的帮众们批评c++的那些缺点。如果没有copy-ctor, dtor,那么 代码:
代码:
代码:
|
![]() |
| 书签 |
| 主题工具 | |
| 显示模式 | |
| |
相似的主题 | ||||
| 主题 | 主题作者 | 版面 | 回复 | 最后发表 |
| [普通]找到一篇关于haskell OO实现的文章。Ajoo可以看看 | SnowFlacon | 技术杂烩 | 33 | 2004-10-03 05:12 AM |
| [普通]Bjarne 关于 C++0x Std 的设想 | 完美废人 | C/CPP/TMP/GP | 18 | 2004-07-10 03:28 AM |
| [普通]Mihai Budiu's Interview with Brian Kernighan | polyrandom | 技术杂烩 | 14 | 2004-06-26 09:52 PM |
| Larry的文章,虽然我不同意他的有些观点。但是值得一读。 | polyrandom | 技术杂烩 | 0 | 2002-10-28 02:26 PM |
| Delphi vs Visual C++ -- Introduction | Innocentius | 技术杂烩 | 9 | 2002-10-11 12:05 PM |