关于C的作者观点 [英] An Authors View on C

查看:44
本文介绍了关于C的作者观点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.embedded.com 上的一位男士发表了他的意见C语言和我

对于作者的支持者数量感到震惊。**我*也*发现*它

很难相信所有代码的99%有内存泄漏;但是,我想我可能是错误的。


看看你的想法:

http://www.embedded.com

showArticle.jhtml; jsessionid = 4DOBHEJ2YZUKUQSNDBCSK HQ?articleID = 15306089

Sean

-

删除I-WANT-NO-SPAM以电子邮件回复。

解决方案

Fao,Sean写道:

一个人在 http://www.embedded.com 发表了他对C语言的看法,我很震惊地看到了作者的支持者人数。我也发现很难相信99%的代码都有内存泄漏;但是,我想我可能是错的。

看看你的想法:

http://www.embedded.com
showArticle.jhtml; jsessionid = 4DOBHEJ2YZUKUQSNDBCSK HQ?articleID = 15306089



C确实允许你做蠢事。 C

也可以让你做出聪明的事情。 C不妨碍你。这取决于你。

如果你宁愿用语言来保护你自己,

你使用了错误的语言。 C很强大,就像电锯一样。就像电锯一样,它可以在坏人手中造成很大的伤害。那不是b $ b意味着C是一种糟糕的语言,不仅仅是电锯是坏工具。


99%的数字是错误的。只有90%的PC程序存在内存泄漏。 (所以

证明我错了。)Cf Sturgeon's Law。


-

Richard Heathfield: bi **** @ eton.powernet.co.uk

Usenet是一个奇怪的。地方" - Dennis M Ritchie,1999年7月29日。

C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

K& R答案,C书等:< a rel =nofollowhref =http://users.powernet.co.uk/etontarget =_ blank> http://users.powernet.co.uk/eton




" Fao,Sean" <恩********** @ yahoo.comI-WANT-NO-SPAM>在留言中写道

news:9v ********************** @ news1.news.adelphia。 net ...

http://www.embedded.com 发表了他对C语言的看法,我很震惊地看到作者的支持者数量。我也发现很难相信99%的代码都有内存泄漏;但是,我想我可能是错的。

看看你的想法:

http://www.embedded.com
showArticle.jhtml; jsessionid = 4DOBHEJ2YZUKUQSNDBCSK HQ?articleID = 15306089



那篇文章有很多要点。一开始就说明了基本原则:


C,所有嵌入式语言中最受欢迎的,是一场彻头彻尾的灾难,一场奇怪的事情大杂烩意味着
给程序员太多的控制权。 C ++并不是更好。语言是

旨在提供无限的灵活性,让开发人员可以在

计算机上做任何事情。


<<

你必须限制程序员可以做些什么来避免错误。这是一个糟糕的结论,真实的

事实,比如正确使用malloc和free的难度。


我提出垃圾收集作为解决这个问题的方法。 GC允许你避免使用
malloc和free。请参阅 http://www.cs.virginia.edu/~lcc-win32


另一个真实的事实是C中的原始字符串类型和没有边界

检查数组,特别是字符串。有限数组类型的使用时间很长

逾期和C将继续有评论家指出

语言的这种效率,只要没有提出解决方案标准。


遗憾的是,我们继续使用一种构思错误的数据类型。有界的字符串

真的是该语言的奖励。我们正处于为上述实现发布字符串

包的最后阶段。


有界字符串比传统字符串快得多。 strlen()函数

只是一个内存读取:你只需访问size即可。字段。


其他函数如strcat和其他函数可以实现*更快*更快和

没有任何缓冲区溢出。


使用垃圾收集器更容易完成整个软件包。


文章中的其他内容非常荒谬。他说,例如



C没有格式规则。以令人惊讶的神秘方式编写源代码很容易和通常。任何

语言允许完全随机使用ENTER键(在几乎C中每个字符的几乎每个字符后输入ENTER都是完全合法的)是一种加密工具。帮助创建可靠且可维护的代码。


<<


现在,如果可以的话甚至可以根据你的需要设置自己的程序格式...


jacob



blockquote>

Richard Heathfield写道:


Fao,Sean写道:

一个人在 http://www.embedded.com 发表了他对C语言的看法,我很震惊地看到了作者的支持者。我也发现很难相信99%的代码都有内存泄漏;但是,我想我可能是错的。

看看你的想法:

http://www.embedded.com
showArticle.jhtml; jsessionid = 4DOBHEJ2YZUKUQSNDBCSK HQ?articleID = 15306089


C确实允许你做蠢事。 C
允许你做聪明的事情也是事实。 C不妨碍你。这取决于你。
如果您更愿意使用语言来保护自己,那么您使用的是错误的语言。 C很强大,就像电锯一样。就像电锯一样,它可以在坏人手中造成很大的伤害。这并不意味着C语言是一种糟糕的语言,不仅仅是电锯是坏工具。

99%的数字是错误的。只有90%的PC程序存在内存泄漏。 (所以
证明我错了。)Cf Sturgeon's Law。



虽然电锯类比,C允许我刮掉油漆。所有

的方式是裸机。它是精确的外科医生的手术刀。

内存泄漏,无论它们是什么,与C无关。统计

显示98.7%的统计数据组成。我不知道什么是b
鱼子酱与此有关。该死的,我的饮料在哪里?

-

Joe Wright http://www.jw-wright.com

所有内容都应尽可能简单,但并不简单。

---阿尔伯特爱因斯坦---


A guy at http://www.embedded.com gave his opinion on the C language and I
was shocked to see the number of supporters for the author.**I*also*find*it
hard to believe that 99% of all code has memory leaks; but, I suppose I
could be wrong.

See what you think:

http://www.embedded.com
showArticle.jhtml;jsessionid=4DOBHEJ2YZUKUQSNDBCSK HQ?articleID=15306089

Sean
--
Remove I-WANT-NO-SPAM to reply in email.

解决方案

Fao, Sean wrote:

A guy at http://www.embedded.com gave his opinion on the C language and I
was shocked to see the number of supporters for the author. I also find
it hard to believe that 99% of all code has memory leaks; but, I suppose I
could be wrong.

See what you think:

http://www.embedded.com
showArticle.jhtml;jsessionid=4DOBHEJ2YZUKUQSNDBCSK HQ?articleID=15306089



It is true that C allows you to do stupid things. It is also true that C
allows you to do clever things. C doesn''t get in your way. It''s up to you.
If you''d rather it were up to the language to protect you from yourself,
you''re using the wrong language. C is powerful, like a chainsaw. And just
like a chainsaw, it can do a lot of damage in the wrong hands. That doesn''t
mean that C is a bad language, any more than chainsaws are bad tools.

The 99% figure is wrong. Only 90% of PC programs have memory leaks. (So
prove me wrong.) Cf Sturgeon''s Law.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



"Fao, Sean" <en**********@yahoo.comI-WANT-NO-SPAM> wrote in message
news:9v**********************@news1.news.adelphia. net...

A guy at http://www.embedded.com gave his opinion on the C language and I
was shocked to see the number of supporters for the author. I also find it
hard to believe that 99% of all code has memory leaks; but, I suppose I
could be wrong.

See what you think:

http://www.embedded.com
showArticle.jhtml;jsessionid=4DOBHEJ2YZUKUQSNDBCSK HQ?articleID=15306089



That article has many points. The basic principle is stated at the start:

C, the most popular of all embedded languages, is an utter disaster, a bizarre hodgepodge meant to
give the programmer far too much control over the computer. C++ isn''t much better. The languages are
designed to provide infinite flexibility, to let the developer do anything that can be done on the
computer.

<<
You have to limit what the programmer can do to avoid mistakes. This is a bad conclusion from real
facts like the difficulty of using correctly malloc and free.

I proposed garbage collection as the means of solving this. GC allows you to avoid
malloc and free. See http://www.cs.virginia.edu/~lcc-win32.

Another real fact is the primitive string type in C and the absence of bounds
checking of arrays, specially strings. The use of a bounded array type is long
overdue and C will continue to have critics that will point out this defficiency in the
language as long as no solution is proposed by the standard.

It is a pity that we go on with a badly conceived data type. Bounded strings would
be really a bonus for the language. We are in the final phase of releasing a string
package for the above implementation.

Bounded strings are much faster than traditional strings. The strlen() function
is just a memory read: you just access the "size" field.

Other functions like strcat and others can be implemented *much* faster and
without any buffer overflows.

The whole package is easier to do with the garbage collector.

The other points in the article are ridiculous. He says, for instance


C has no formatting rules. It''s easy and usual to write source in astonishingly cryptic ways. Any
language that allows utterly random use of the ENTER key (it''s perfectly legit to hit ENTER after
almost every character in C) is more an encryption tool than an aid to creating reliable and
maintainable code.

<<

Now, if you can''t even format your own program as you seem fit...

jacob




Richard Heathfield wrote:


Fao, Sean wrote:

A guy at http://www.embedded.com gave his opinion on the C language and I
was shocked to see the number of supporters for the author. I also find
it hard to believe that 99% of all code has memory leaks; but, I suppose I
could be wrong.

See what you think:

http://www.embedded.com
showArticle.jhtml;jsessionid=4DOBHEJ2YZUKUQSNDBCSK HQ?articleID=15306089



It is true that C allows you to do stupid things. It is also true that C
allows you to do clever things. C doesn''t get in your way. It''s up to you.
If you''d rather it were up to the language to protect you from yourself,
you''re using the wrong language. C is powerful, like a chainsaw. And just
like a chainsaw, it can do a lot of damage in the wrong hands. That doesn''t
mean that C is a bad language, any more than chainsaws are bad tools.

The 99% figure is wrong. Only 90% of PC programs have memory leaks. (So
prove me wrong.) Cf Sturgeon''s Law.


The chainsaw analogy notwithstanding, C allows me to "scrape paint" all
the way down to "bare metal". It is precise as a fine surgeon''s scalpel.
Memory leaks, whatever they are, have nothing to do with C. Statistics
show that 98.7 percent of all statistics are made up. I don''t know what
caviar has to do with this. Dammit, where''s my drink?
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---


这篇关于关于C的作者观点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆