为什么C ++向后兼容C?为什么没有一些“纯"的替代品呢? C ++语言? [英] Why is C++ backward compatible with C ? Why isn't there some "pure" C++ language?

查看:79
本文介绍了为什么C ++向后兼容C?为什么没有一些“纯"的替代品呢? C ++语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C和C ++是不同的语言,我们知道这一点.

C and C++ are different languages, blababla we know that.

但是,如果这些语言不同,为什么仍然可以使用malloc或free之类的函数?我确定C ++会因为C而带来各种尘土飞扬的事物,但是由于C ++是另一种语言,为什么不删除这些事物以使其变得不那么肿胀,更干净清晰呢?

But if those language are different, why is it still possible to use function like malloc or free ? I'm sure there are all sort of dusty things C++ has because of C, but since C++ is another language, why not remove those things to make it a little less bloat and more clean and clear ?

是因为它允许程序员在没有OO模型的情况下工作,还是因为某些编译器不支持C ++的高级抽象功能?

Is it because it allows programmers to work without the OO model or because some compilers doesn't support high-level abstract features of C++ ?

推荐答案

关于为什么没有纯" C ++语言……嗯,至少有一种.最受欢迎的一种叫做D,它很棒,很好设计,功能丰富,易于编写代码,并且可以将C库与之配合使用.

About "Why there's no "pure" C++ language... Well, there is at least one. The most popular one is called D, it's great, well-designed, feature-rich, pleasant to code with, and you can use C libraries with it.

啊,几乎没有人使用它. :)

Ah, and almost nobody uses it. :)

直接的原因是C ++的性能还不足以使人们有充分的理由将其数百万行的遗留代码移植到更现代的语言上,正如您所描述的,这些语言是纯"语言(例如D).

The direct reason is that C++ is not bad enough to give people a good reason to port millions of lines of their legacy code to more modern, and as you described, "pure" languages like D.

这篇关于为什么C ++向后兼容C?为什么没有一些“纯"的替代品呢? C ++语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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