何时使用C以及何时使用C ++ [英] when to use C and when to use C++

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

问题描述

大家好,


我被问过这个问题很多次,我想知道

可能是什么原因?


"什么时候更喜欢C而不是C ++,反之亦然,当然这是真实的

世界实用场景


根据我的理解,C ++让它变得更容易程序应用

相关逻辑,因为OOPS在这个意义上有帮助,但由于某种原因,这不是一个合理的解释,任何人都可以添加他们的评论吗?

Hi everyone,

I have been asked this question quite a few times and i wonder what
could the actual reason?

" When to prefer C over C++ or vice versa, of course this is for real
world pratical scenario"

As per my understanding, C++ makes it easier to program application
related logic as OOPS helps in that sense, but for some reason that is
not a reasonable explanation, could any one add on their comments?

推荐答案

sa ***** @ yahoo .co.in 写道:

大家好,


我被问到这个问题不少时间,我想知道

可能是什么原因?


"什么时候更喜欢C而不是C ++,反之亦然,当然这是真实的世界实际情景
Hi everyone,

I have been asked this question quite a few times and i wonder what
could the actual reason?

" When to prefer C over C++ or vice versa, of course this is for real
world pratical scenario"



通常问题的原因是某些混蛋想要开始

a火焰战。

Usually the reason for the question is that some asshole wants to start
a flame war.


根据我的理解,C ++使编程应用程序更容易

相关逻辑,因为OOPS在这个意义上有所帮助,但由于某些原因,这不是
一个合理的解释,任何人都可以加上他们的评论吗?
As per my understanding, C++ makes it easier to program application
related logic as OOPS helps in that sense, but for some reason that is
not a reasonable explanation, could any one add on their comments?



当然,对于这个问题而言,这不是一个合理的解释,而不是

足够的答案。这至多是一种偏见,最糟糕的是谎言。

Of course it is not a reasonable explanation for the question not an
adequate answer for it. It is at best a prejudice, at worst a lie.


sa * **** @ yahoo.co.in écrit:
sa*****@yahoo.co.in a écrit :

大家好,


我有有人问过这个问题很多次,我想知道

的实际原因是什么?


"什么时候更喜欢C而不是C ++,反之亦然,当然这是真实的

世界实用场景


根据我的理解,C ++让它变得更容易程序应用

相关逻辑,因为OOPS在这个意义上有帮助,但由于某种原因,这不是一个合理的解释,任何人都可以添加他们的评论吗?
Hi everyone,

I have been asked this question quite a few times and i wonder what
could the actual reason?

" When to prefer C over C++ or vice versa, of course this is for real
world pratical scenario"

As per my understanding, C++ makes it easier to program application
related logic as OOPS helps in that sense, but for some reason that is
not a reasonable explanation, could any one add on their comments?



C ++的问题在于它是一种非常复杂的语言。人们花了很多时间来掌握它的复杂性,这需要花费很多时间,而不想打扰的人可能会使用C.


使用C和垃圾收集器使得许多功能因为内存管理而不需要C ++的C ++,这是构造函数/析构函数的主要原因之一

从视图中消失。


C的问题在于语言因STL等数据结构的任何高级库的缺失而严重削弱。这不是语言本身的问题,而是人们组织了讨论和演变C.标准委员会否认任何进展

语言显然他们已经决定在未来10年内不会出现新的标准

,因为没有C 2009

和下一个标准将(也许)出现在2019年...


这意味着在实践中,C中不存在列表,数组和许多其他常用的
数据结构标准库。这意味着你需要使用一些外部库,将代码绑定到它上面,

许多人不想做的事情,所以他们开始无休止地编码

他们的第1000个链表包。


这个组是C问题的一部分。从答案可以看出

of上面的Ambuhl先生,它充满了那些认为侮辱的人只有那些想要讨论比以下更严重的人的答案:


< begin引用>

嗨人们


我编码:

i ++ =(i ++ + i ++);


并且它不起作用...... PLEEZE HELP

<结束语>


一般来说,有关C演变的挫折被一群被称为常客的人系统地摧毁了。我们认为*他们* C的视图(约1989年冻结)是可以在这个组中保护的

唯一视图。


因此,由于comp.std.c具有相同的视图,实际上没有

讨论组,并且根本没有讨论C的演变。


什么时候使用C?


你可以在任何地方使用C,你可以用它编码任何东西,这是一般的

目的语言。它的优点是简单,其缺点是它的简单。


jacob

The problem of C++ is that it is an extremely complex language. People
that have invested a lot of time in mastering its complexity are
productive with it, people that do not want to bother may use C.

Using C coupled with a garbage collector makes many of the features
of C++ unnecessary since memory management, one of the principal reasons
for constructors/destructors disappears from view.

A problem with C is that the language is severly crippled by the absence
of any high level library for data structures like the STL. This is not
a problem with the language itself but with the people that organize the
discussion and evolution of C. The standards comitee denies any progress
to the language and apparently they have decided that no new standard
will appear in the next 10 years or so, since there will be no C 2009
and the next standard will (maybe) appear in 2019...

This means in practice that lists, arrays and many other commonly used
data structures are absent from the C standard library. It means too
that you have to use some external library, tying your code to it,
what many people will not want to do, so they start endlessly coding
their 1000th linked list package.

This group is part of the problem of C. As you can see from the answer
of Mr Ambuhl above, it is full of people that think insults are the
only answer to people that want to discuss anything more serious than:

<begin quote >
Hi people

I have coded:
i++ = (i++ + i++);

and it doesnt''t work... PLEEZE HELP
< end quote>

In general, disucssions concerning the evolution of C are destroyed
systematically by a group of people called "regulars" that have
taken as granted that *their* view of C (frozen about 1989) is the
only view that can be defended in this group.

So, since comp.std.c has the same view, there is effectively no
discussion group, and no discussion of the evolution of C at all.

When to use C?

You can use C anywhere, you can code anything with it, it is a general
purpose language. Its advantages are its simplicity, and its
disadvantages are its simplicity.

jacob


jacob navia写道:
jacob navia wrote:

>

使用C加上垃圾收集器可以实现许多功能

C ++不需要内存管理,其中一个主要原因是构造函数/析构函数的
从视图中消失。
>
Using C coupled with a garbage collector makes many of the features
of C++ unnecessary since memory management, one of the principal reasons
for constructors/destructors disappears from view.



我不喜欢我打算被吸引到另一个毫无意义的GC争论中,但是这个b $ b不符合事实。内存只是可以通过带有构造函数和析构函数的对象来管理的b / b
中的众多资源之一,这就是为什么这个成语被称为资源获取是初始化的原因。 ;。


-

Ian Collins。

I don''t intend to be drawn into yet another pointless GC debate but this
falls short of the truth. Memory is but one of the many resources that
can be managed through objects with constructors and destructors, that''s
why the idiom is called "Resource Acquisition Is Initialization".

--
Ian Collins.


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

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