为什么我们使用C比C ++ ... [英] Why We Use C Than C++...

查看:75
本文介绍了为什么我们使用C比C ++ ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我这方面......

所有内核级程序都是用C语言编写的(即:开源

LINUX)。 ..为什么他们没有使用C ++ ...我个人觉得C ++比B更容易编码...当我在我们的百科全书中搜索时(即

谷歌),我想出了几个答案,告诉他们C比C ++快得多,而大多数核心prgms只使用C。 ......但为什么会这样......?为什么

他们在这些基于操作系统的程序中使用C ..请帮我详细说明

说明...


干杯,

Balaji Jayaraman ......

Hi, Please help me in this regard...
All the kernel level programs are written in C... (i.e: Open Source
LINUX)... Why are they not using C++... I personally feel that C++ is
more easy to code than C... When i searched in our encyclopedia (i.e
Google), i came up with several answers, telling "C is much faster than
C++ and most kernal prgms uses only C" ... But why is it so...? Why
they use C for these OS based programs.. Please Help me with detailed
explanation...

Cheers,
Balaji Jayaraman...

推荐答案

在一个发展良好的C ++程序中,没有C

和C ++性能之间存在很大差异。


以下文章描述了从C ++到C代码的映射。

http://www.eventhelix.com/RealtimeMa...erformance.htm
http://www.eventhelix.com /RealtimeMa...rformance2.htm

C ++中最大的性能影响来自隐含的传递

this每个

函数中的指针。但是,C ++可以通过更好的局部性来弥补这一点

的引用。这可以转换

来改善缓存性能。


-

EventStudio系统设计器2.5 - http://www.EventHelix.com/EventStudio

带有序列图的系统设计PDF格式和Word EMF

In a well developed C++ program, there isn''t much difference between C
and C++ performance.

The following articles describe a mapping from C++ to C code.

http://www.eventhelix.com/RealtimeMa...erformance.htm
http://www.eventhelix.com/RealtimeMa...rformance2.htm

The biggest performance hit in C++ comes from the implicit passing of
the "this" pointer in every
function. However, C++ more than makes up for this by better locality
of reference. This translates
to improved cache performance.

--
EventStudio System Designer 2.5 - http://www.EventHelix.com/EventStudio
System Design with Sequence Diagrams in PDF and Word EMF


所以***** ***@gmail.com 说:
请帮我这方面......
所有内核级程序都是用C语言编写的。 ..(即:开源
LINUX)...为什么他们不使用C ++ ...我个人认为C ++比C更容易编码...当我在我们的百科全书中搜索(即谷歌),我提出了几个答案,告诉他们C比C ++快得多,而且大多数核心语言仅使用C。 ......但为什么会这样......?为什么
他们使用C来实现这些基于操作系统的程序..请帮我详细说明......
Hi, Please help me in this regard...
All the kernel level programs are written in C... (i.e: Open Source
LINUX)... Why are they not using C++... I personally feel that C++ is
more easy to code than C... When i searched in our encyclopedia (i.e
Google), i came up with several answers, telling "C is much faster than
C++ and most kernal prgms uses only C" ... But why is it so...? Why
they use C for these OS based programs.. Please Help me with detailed
explanation...




部分原因是因为C更快(在某些地方)。部分是因为它更简单,所以它更容易做对。但大多数情况下,我认为,因为C是第一位的。当第一次写入

内核时,C已经确定了,而C ++仍然处于相当大的流量状态。并且,一旦它/写在C中,如果一个合理的工作是合理的(当然看来是这样),为什么在

地球上会有人是否需要重写它?


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)



Partly because C is faster (in places). Partly because it''s simpler, so it''s
easier to get right. But mostly, I think, because C came first. When the
kernel was first being written, C had already firmed up, whilst C++ was
still in a state of considerable flux. And, once it''s /written/ in C, if a
reasonable job was made (which certainly seems to be the case), why on
earth would anyone bother to rewrite it?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


Richard Heathfield< in **** *@invalid.invalid>写道:
Richard Heathfield <in*****@invalid.invalid> writes:
部分是因为C更快(在某些地方)。部分原因是因为它更简单,所以它更容易做对。但大多数情况下,我认为,因为C首先来了。
Partly because C is faster (in places). Partly because it''s simpler,
so it''s easier to get right. But mostly, I think, because C came
first.




另一个重要因素是C ++需要更多的运行时支持

代码工作正常。


DES

-

Dag-Erling Sm?rgrav - de *@des.no


这篇关于为什么我们使用C比C ++ ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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