C ...为什么不用c ++? [英] C... Why not c++?

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

问题描述

有人可以说我为什么用C而不是C ++?到现在为止,我从来都没有为这个发现过这样的计划。

用C语言编写的每个项目都可以写成

c ++,如果现在仍然看到C代码,我真的不会理解为什么同样的东西不能用c ++编写。使用c ++

它可以缩短开发时间,实现相同的结果。

你能给我一个有效的C理由吗?

解决方案

简单来说,OO&某些针对OS内核开发和设备驱动程序的
项目不需要模板功能

开发和其他低级库。此外,大多数

功能都需要C ++运行时库,如果编写操作系统内核,它实现起来太复杂了。请注意,用什么语言编写C ++运行时库?
然后你可以说C ++支持C89和一些扩展并且可以写
没有OO的
代码。那么为什么C存在?我想也许C ++的功能

命名不能与C兼容?进一步改善C?我无法给出

的确切原因。至于编译器,C通常是实现的第一种语言,而在GCC中,它是Obj-C或C ++或Java或Ada的背景。


这里只是一个想法,但没有回答你的问题。


恕我直言,我认为C ++会因为有更多的时间而给予更长的开发时间br />
需要处理的事情,如类,私有,公共,受保护,
虚函数,还有继承等,并且有负载。 C ++中有更多的

限制。虽然不是坏事。相反,我认为这肯定会减少维修时间。


对OP来说,你可以向我们展示为什么使用C ++而不是C? :)


-

-------------------------- --------

删除(无 - 垃圾邮件)回复

< dj *** @ excite.it>在消息中写道

news:66 ************************** @ posting.google.c om ...

有人可以说我为什么用C代替C ++?到目前为止,我从来没有为此找到过exaplanation。
用C语言编写的每个项目都可以用c ++编写,而现在还是看不见C代码我真的不明白为什么同样的东西不能用c ++编写。使用c ++
可以缩短开发时间,实现相同的结果。
你能给我一个有效的C理由吗?






" dj *** @ excite.it"写道:

有人可以说我为什么用C代替C ++?到目前为止,我从来没有为此找到过exaplanation。
用C语言编写的每个项目都可以用c ++编写,而现在还是看不见C代码我真的不明白为什么同样的东西不能用c ++编写。使用c ++
它可以缩短开发时间,达到相同的效果。
你能给我一个有效的C理由吗?




为了什么?一台电脑?一个MainFrame,一台打印机?电视?

对于许多小型系统来说,C ++的额外开销太大了。

内存是千字节而不是兆字节。

问题是C或汇编程序(而且C并不总是胜利者)。


你的问题告诉我你是一名PC程序员。那么什么样的

计划。一个司机?一个简单的用户应用?一个财富500强的公司数据库

系统?那个开发团队呢?他们擅长什么?嘿

为什么不是Java或C#或C.Net?

C ++不是C替代品。它有自己的优点和缺点。对于

小项目来说,这是程序员的选择。他擅长的是最快的。

对于大型项目项目负责人需要找出最好的

语言。 C ++并不保证项目编码更好,或者更快地完成



顺便说一下如果要在桥下拖回来的话。


Someone can exaplain me why use C instead C++? Until now i''ve never
found exaplanation for this.
Every project written in C on which i''ve worked could be written in
c++, and when in nowadays happen still to see C code i really don''t
understand why the same things cannot be written in c++. Using c++
it''s possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?

解决方案

Simple enough, the OO & template features are not needed on some
projects targeted to OS kernel development and device driver
development and other low-level libraries. Moreover, most of the
features require the C++ runtime library and it''s too complex to
implement if you write a OS kernel. Note that in WHAT language do you
write the C++ runtime library?

Then you may say that C++ support C89 and some extensions and can write
code without OO. So why does C exist? I think maybe C++''s function
naming can''t be compatible with C? To further improve C? I can''t give
an exact reason. As to the compiler, C is often the first language to
implement and in GCC it''s the background of Obj-C or C++ or Java or Ada.


Just a thought here but not relate to answering your question.

IMHO, I think C++ will give longer developing time due to there is more
things to be taken care of, like class, and private, public, protected,
virtual functions, also inheritance etc, and there is loads. There is more
restrictions in C++. Not a bad thing though. Instead, I think it will reduce
the maintenace time for sure.

To OP, can you exaplain to us why use C++ instead of C? :)

--
----------------------------------
remove "(n.o---s.p.a.m)" to reply
<dj***@excite.it> wrote in message
news:66**************************@posting.google.c om...

Someone can exaplain me why use C instead C++? Until now i''ve never
found exaplanation for this.
Every project written in C on which i''ve worked could be written in
c++, and when in nowadays happen still to see C code i really don''t
understand why the same things cannot be written in c++. Using c++
it''s possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?





"dj***@excite.it" wrote:

Someone can exaplain me why use C instead C++? Until now i''ve never
found exaplanation for this.
Every project written in C on which i''ve worked could be written in
c++, and when in nowadays happen still to see C code i really don''t
understand why the same things cannot be written in c++. Using c++
it''s possble to reduce developing time achieving the same result.
Can you give me a valid reason for C?



For What? a PC? a MainFrame, a Printer? a TV?
For many small systems the extra overhead for C++ is too much. The
memory is in Kbytes not Megabytes.
The question there is C or assembler ( and C is not always the winner).

Your question indicates to me you are a PC programmer. So what kind of
program. a driver? a simple user app? a fortune 500 company database
system? What about the development team? what are they good at? Hey
why not Java or C# or C.Net?
C++ is not a C replacement. It has its own pluses and minuses. For
small project it is programers choice. What he is good at is quickest.
For massive projects The project leader need to figure out the best
language. C++ does not guarantee the project is coded better, or is
done quicker.

BTW if to are trolling back under the bridge.


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

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