为什么大多数Linux程序都用C语言编写?为什么他们不是用C写的,哪个更新?解决方法:关于这一点已经有很多讨论.主要原因是哲学原因.C被发明为系统开发的简单语言(而不是应用程序开发).使用C有很多论据,但是有很多不使用...
为什么大多数Linux程序都用C语言编写?为什么他们不是用C写的,哪个更新?
解决方法:
关于这一点已经有很多讨论.主要原因是哲学原因.
C被发明为系统开发的简单语言(而不是应用程序开发).使用C有很多论据,但是有很多不使用C并坚持使用C.
最后,这是一个历史问题.大多数应用程序都是用C语言编写的,因为大多数内核都是用C语言编写的.从那时起,大多数内容都是用C语言编写的,人们倾向于使用原始语言.
此时,有人可能会问“好的,那么为什么内核用C编写而不是移植到C?”.这已经在on kerneltrap前面讨论过了.可以引用此线程的一个很好的解释是响应by yoshi314(直接引用):
that’s because nearly every c++ app needs a separate c++ standard library to operate. so they would have to port it to kernel, and expect an extra overhead everywhere.
c++ is more complex language and that means that compiler creates more complex code from it. because of that, finding that a problem stems from compiler bug,rather than code error is easier in c.
also c language is more barebone, and it’s easier to follow its assembly representation, which is often easy to predict.
c++ is more versatile, but c is more suited for lowlevel or embedded stuff.
另一方面,“大多数Linux程序”都具有误导性.看看图形应用程序. Python越来越受到关注,特别是在Linux上的GUI环境中.关于Windows和.NET发生的事情.
本文标题为:为什么大多数Linux程序都用C语言编写?
基础教程推荐
- Qt数据库应用之实现通用数据库请求 2023-03-18
- g++: const 丢弃限定符 2022-10-07
- 纯C++代码详解二叉树相关操作 2023-05-15
- character-encoding – Linux中最常见的C语言编码(和Unix?) 2023-11-21
- C语言数组长度的计算方法实例总结(sizeof与strlen) 2023-04-26
- 05-C语言进阶——动态内存管理 2023-11-20
- C语言植物大战数据结构二叉树递归 2023-04-09
- 利用QT设计秒表功能 2023-05-30
- VisualStudio2010安装教程 2023-01-05
- C语言的三种条件判断语句你都了解吗 2023-03-05
