返回   cpper编程论坛 > 灌水/杂烩/BT
注册账号 论坛帮助 会员列表 日历事件 搜索 今日新帖 标记版面已读

灌水/杂烩/BT 所有非技术的东西都往这里来

回复
 
LinkBack 主题工具 显示模式
  #1 (permalink)  
旧 2007-09-07
cat cat 当前离线
高级会员
 
注册日期: 2003-11-06
帖子: 1,563
文章: 6
cat 正向着好的方向发展
默认 Linus: C++ is a horrible language

这里没人吵架,就看看别人吵架算了。老家伙够固执的……(不知道他多大,不过看这个样子觉得像是个老家伙

不过我也觉得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 编辑.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #2 (permalink)  
旧 2007-09-07
高级会员
 
注册日期: 2006-02-11
帖子: 139
zero 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

Linus不大的,但是一直很嚣张的,毕竟人家是Linux之父啊
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #3 (permalink)  
旧 2007-09-08
housisong 的头像
高级会员
 
注册日期: 2003-08-28
住址: 深圳`
帖子: 446
文章: 6
housisong 正向着好的方向发展
发送 MSN 消息给 housisong
默认 回复: Linus: C++ is a horrible language

代码的质量主要还是靠人和一些约定来保证的,语言本身只是一个工具
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #4 (permalink)  
旧 2007-09-08
cat cat 当前离线
高级会员
 
注册日期: 2003-11-06
帖子: 1,563
文章: 6
cat 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

同意,不过有些语言一旦编译通过代码就不会太难懂或者容易隐藏那些tricky的bug. 那边吵架的人某一个说C提供了“正确”的抽象,不多也不少,code不太难写也不至于太容易出错。我觉得这个说法很有意思,不过平时写code我还是觉得C的抽象能力稍微低了点,不是最爽;C++又太多了。

BTW大学的时候有一个作业说要看了一把linux的kernel的调度什么的code, 写得实在不怎么好懂而且几乎没有注释…… sigh 不敢恭维啊……

此帖于 2007-09-08 12:33 PM 被 cat 编辑.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #5 (permalink)  
旧 2007-09-08
polyrandom 的头像
超级版主
 
注册日期: 2002-09-03
帖子: 3,138
文章: 20
polyrandom 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

我觉得这个和语言本身无关,而是现在C++的编译器还是比较烂。
或者,更精确地说,C++太复杂了,以至于你写C++的时候,你不知道你在写什么。
以前记得写Quake的某位老大(记不得是不是John了)说,他写C代码的时候,写出来的是C,但是看到的是汇编。也就是说,C对他来说只是一个更高级的汇编而已。但是到了C++,他就做不到这点了,他恐慌了,他失去自我了......
对这种人来说,C是最好的,C++还不如汇编。对于Linus来说,我觉得他说得也有道理。如果有人坚持操作系统核心代码需要用C写,甚至汇编写,我觉得是有道理的。因为你实在无法控制C++的代码究竟能够被优化的多好。
至于linux的代码有些烂也可以理解的,那么大的一砣东西
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #6 (permalink)  
旧 2007-09-08
cat cat 当前离线
高级会员
 
注册日期: 2003-11-06
帖子: 1,563
文章: 6
cat 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

sigh 传说windows的kernel的code很漂亮的~ 完美的注释,清晰的逻辑。就是没见过……
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #7 (permalink)  
旧 2007-09-09
高级会员
 
注册日期: 2006-02-11
帖子: 139
zero 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

去Redmond吧
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #8 (permalink)  
旧 2007-09-17
bankrock 的头像
高级会员
 
注册日期: 2003-12-11
帖子: 847
文章: 7
bankrock 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

我觉得这还是和语言的特长有关,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++后,再学其他什么语言都感觉是小菜一碟
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #9 (permalink)  
旧 2007-09-18
cat cat 当前离线
高级会员
 
注册日期: 2003-11-06
帖子: 1,563
文章: 6
cat 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

不觉得system-level的design不用到OO的思想 那个讨论里面也说很多人尝试把一些C code转成C++, 因为里面有些还是很OO的,用C++重写不是更好? 但实际上C++的那些缺点远超过仅仅在代码表达上的改进。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #10 (permalink)  
旧 2007-09-18
bankrock 的头像
高级会员
 
注册日期: 2003-12-11
帖子: 847
文章: 7
bankrock 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

那里就一个人提议要用C++重写,结果被轮着批了一遍。
反对的人认为这个string库最重要的就是速度,但是C++的OO方法有太多不可控的因素,无法达到速度优化的要求。感觉他们的意思C可以用模块化实现的东西没必要牵涉到OO。最后还有个变态说用汇编优化比C还快,而C只是"a little portable",OO和这些人思想隔了不止一堵墙。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #11 (permalink)  
旧 2007-09-18
polyrandom 的头像
超级版主
 
注册日期: 2002-09-03
帖子: 3,138
文章: 20
polyrandom 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

我觉得C++的问题在于它同时追求语法和效率。事实上C++对FP的支持还不如Python好看,但是问题在于,一旦C++过于追求语法上的完美,最后它将沦为小语言。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #12 (permalink)  
旧 2007-09-19
bankrock 的头像
高级会员
 
注册日期: 2003-12-11
帖子: 847
文章: 7
bankrock 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

语法实际上还是要考虑兼容C吧,BS说过smalltalk才是他心中最佳的语法典范(虽然我不知道到底什么样)。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #13 (permalink)  
旧 2007-09-19
Elminster 的头像
超级版主
 
注册日期: 2002-09-09
帖子: 1,764
Elminster 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

C++ 再这样下去,离沦为小语言也不远了吧?底层开发和纯 C 打了这么多年,也没有能真的赢下来多少,企业应用领域基本上是完败给 Java/C# 这些东西。如今又冒出一个 D 语言,虽然我看了之后并不喜欢这个东西,不过这绝对是个危险信号:很多人已经觉得应该有个东西干净彻底地替代 C++ 了 ……
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #14 (permalink)  
旧 2007-09-24
liuxinyu 的头像
高级会员
 
注册日期: 2006-02-09
帖子: 311
文章: 49
liuxinyu 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

引用:
作者: polyrandom 查看帖子
我觉得C++的问题在于它同时追求语法和效率。事实上C++对FP的支持还不如Python好看,但是问题在于,一旦C++过于追求语法上的完美,最后它将沦为小语言。
我个人意见倒是觉得,小生境未必不好。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #15 (permalink)  
旧 2007-09-28
高级会员
 
注册日期: 2002-11-22
帖子: 249
clip 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

也许有人早就贴过了,也许并不太准确
TIOBE Software - The Coding Standards Company
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #16 (permalink)  
旧 2007-10-05
高级会员
 
注册日期: 2002-09-15
帖子: 2,531
ajoo 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

搞Java的人,整天就摇头晃脑地琢磨封装啊,抽象啊,对接口编程啊,依赖注射呀这些高来高去虚头八脑的东西。(对,咱没有ruby/python的closure/lamdba,string interpolation等等花拳绣腿,但是我们可以和蔼慈祥地正告他们,你们那个东西慢的一塌糊涂,小孩子过家家的东西也拿来显?一边儿玩儿去吧,别淘气啊。)最烦的就是cpper象蚊子一样地“效率, 效率”地念经。我们无数次地忍无可忍歇斯底里地大喊:java已经不比c++慢了,有些地方我们还可以超过你们啦,啦,啦!!!!

可是,不知道是我们的声音不够振聋发聩还是你们故意装作听不见,还是总有cpper继续象蚊子一样地在耳边墨迹:“效率,效率,效率”。真是有种秀才遇见兵的无助感啊。


哈哈。这下好了。linus骂的这叫一个痛快,读linus的文章我可是一行一行文字反复地咀嚼,品味,那行文如天马行空,潇洒恣肆,眼前不禁蹭蹭蹭闪过许多英雄形象来(啊,说错了,是文学作品中意气风发,指点江山,口沫横飞的北京小痞子形象)。读后也是唇齿留香,回味无穷啊。小样儿的,你也有今天?遭报应了吧?知道啥叫小人得志不?知道啥叫落井下石不?不知道?那今天大爷就让你知道知道。hia, hia hia!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #17 (permalink)  
旧 2007-10-05
高级会员
 
注册日期: 2002-09-15
帖子: 2,531
ajoo 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

感觉这linus怎么抄袭我的观点呢?这
引用:
And if you want a fancier language, C++ is absolutely the worst one to
choose. If you want real high-level, pick one that has true high-level
features like garbage collection or a good system integration, rather than
something that lacks both the sparseness and straightforwardness of C,
*and* doesn't even have the high-level bindings to important concepts.

IOW, C++ is in that inconvenient spot where it doesn't help make things
simple enough to be truly usable for prototyping or simple GUI
programming, and yet isn't the lean system programming language that C is
that actively encourags you to use simple and direct constructs.
明明是我三十年前在abp上公开发表的理论嘛。

我当时还强烈推荐一种设计方式:ajoo c++。
就是不要用拷贝构造函数和析构函数(只用scope guard)。对象拷贝都是bit copy。对象也不自动对资源拥有所有权和释放权。

这两样,加上如果c++的template不是现在这样搞的一团糟的话,就足以拯救c++了。看看linus的帮众们批评c++的那些缺点。如果没有copy-ctor, dtor,那么
代码:
a = b + "/share/" + c + serial_num;
这种对新手虚假友好的代码根本就写不出来,你只能这样写:
代码:
StringBuilder builder; builder << b << "/share/" << c << serial_num; char* resultString = builder.getString(); // get the inner string.
然后,在所有程序员对这种写法造成的不方便严重不满的时候,c++也许就被迫加入string interpolation的语法:
代码:
char* str= '${b}/share/${c}${serial_num}'; //单引号用来标明需要编译器的string interpolation支持。 ScopeGuard(delete [] str); // 具体语法忘了。反正是当前scope结束的时候调用
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #18 (permalink)  
旧 2007-10-05
bankrock 的头像
高级会员
 
注册日期: 2003-12-11
帖子: 847
文章: 7
bankrock 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

C++没GC,要是RAII也没了,那异常安全咋办?难道再退化到C去?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #19 (permalink)  
旧 2007-10-06
高级会员
 
注册日期: 2002-09-15
帖子: 2,531
ajoo 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

引用:
作者: bankrock 查看帖子
难道再退化到C去?
嘘。小声点。小心Linus跟你急。

其实,c++的异常就是个鸡肋呀鸡肋。无数牛人,大公司都坚决不用它的。嘿嘿。

再说,不是还有scope guard么?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
  #20 (permalink)  
旧 2007-10-06
bankrock 的头像
高级会员
 
注册日期: 2003-12-11
帖子: 847
文章: 7
bankrock 正向着好的方向发展
默认 回复: Linus: C++ is a horrible language

好哇,Exceptional C++四分之一的内容就成鸡肋了。
我觉得把分配资源的责任加在使用对象的客户手里是不行的,资源获取有时候和实现细节纠缠的太紧了,这样会给用户增加不必要的负担,而且降低封装性。
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
回复时引用此帖
回复

书签

主题工具
显示模式

发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
Trackbacks are 启用
Pingbacks are 启用
Refbacks are 启用


相似的主题
主题 主题作者 版面 回复 最后发表
[普通]找到一篇关于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


所有时间均为格林尼治时间 +9。现在的时间是 08:32 AM


Powered by vBulletin® 版本 3.7.0
版权所有 ©2000 - 2009,Jelsoft Enterprises Ltd.
(C) Copy Right All Right Reserved 2001 - 2007

Search Engine Friendly URLs by vBSEO 3.1.0