是否有适合同龛为C任何语言? [英] Are there any languages that fit the same niches as C?

查看:144
本文介绍了是否有适合同龛为C任何语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

做任何建议,或实施语言适合在同一个(巨大)的利基为C,与被替代的意图,同时保持所有适用于操作系统,高性能嵌入式等角色?


解决方案

  

做任何建议,或实施语言适合在同一个(巨大)的利基为C,与被替代的意图,同时保持所有适用于操作系统,高性能嵌入式等角色?


操作系统进行了汇编历史上实现的。后来发展转移到C,最初是一种宏汇编的。

现在大多数操作系统都写大多是在C,因为它是pretty多只语言,保持某种汇编向后兼容的(例如,一个可以映射在硬件规格中为C汇编一对一狮子股) 。或是libc是主要的接口 - 通常是唯一的接口 - 内核和用户空间之间。然而,该接口包括不是一切:内核中的一些事情有因为没有标准接口(还)供应给直接访问。例如。人们必须使用C结构来传递参数/从读写检索结果/

这意味着,在应用开发中使用C是由一个简单的事实,如果你用C你自动访问内核(OS)的所有功能,这也是C语言编写的推动更大的一部分。

只有那些能够用C莫名其妙竞争语言是一项基于/与C兼容知道我唯一的选择是C ++的语言。在较早的时候也有比较大众化的翻译如 P2C (帕斯卡C):在开发商计划一种语言,但源$ C ​​$ C自动转换成C编译。但译者都相当越野车和无C的知识往往程序不能进行调试。所以,如果你要知道一些C反正,为什么与译者费心了。


我个人(和许多其他开发商我敢肯定),使用不同的语言往往在该操作系统有一个功能问题迷迷糊糊的,但使用不提供任何设施语言来访问它。我认为是其他语言发展的主要威慑因素。即使你有一个新的语言一个明亮的想法(这很可能是用C不相容的,否则的想法就不会那么的的),你最终的负担,重新实现接口pretty多整个操作系统(以及各种必须具备的应用程序库)。

只要(1)C仍是系统编程(2)操作系统接口仍在不断发展的唯一语言,所有非-C兼容语言上的护栏,应用开发的另一边,将处于更加不利的地位。

P.S。其实这是我希望的模具 LLVM /的可能会断裂。铛是作为一个可重用库理论上允许混合语言。例如。主源文件可以用一种语言(和一个前端解析),但的#include 取值可能是C(以及由铿锵解析)。

Do any proposed, or implemented languages fit in the same (enormous) niche as C, with the intention of being an alternative, while maintaining all the applicability to OS, high performance, embedded and other roles?

解决方案

Do any proposed, or implemented languages fit in the same (enormous) niche as C, with the intention of being an alternative, while maintaining all the applicability to OS, high performance, embedded and other roles?

OSs were historically implemented in assembler. Later on development shifted to C, which initially was a sort of macro assembler.

Now most OSs are written mostly in C because it is pretty much only language which maintains some sort of assembler backward compatibility (e.g. one can map one to one lion share of the assembler found in the hardware specs into C). And libc is the primary interface - often is the only interface - between kernel and user-space. And yet the interface covers not everything: some things in kernel has to be accessed directly as no standard interface is (yet) provisioned. E.g. one has to use a C struct to pass parameters/retrieve results to/from ioctl.

That means that the use of C in application development is in greater part pushed by the simple fact that if you use C you get automatically access to all the features of kernel (OS) which is also written in C.

Only language which can somehow compete with C is the language which is based/compatible with C. The sole alternative known to me is the C++. In older times there were also relatively popular translators like p2c (Pascal to C): developer programs in one language, but the source code is automatically translated into C for compilation. But the translators were rather buggy and without knowledge of C often programs couldn't be debugged. So if you have to know some C anyway, why bother with the translators.


I personally (and many other developers I'm sure) using various languages often stumbled upon the problem that the OS has a feature, but the language used doesn't provide any facility to access it. That I think is the major deterrent factor for other language development. Even if you have bright a idea for a new language (which is likely to be incompatible with C, otherwise idea wouldn't be that bright) you end up with the burden to reimplement interface to the pretty much whole OS (and various must-have application libraries).

As long as (1) C remain the sole language for system programming and (2) OS interfaces are still evolving, all non-C-compatible languages on the other side of fence, application development, would be at greater disadvantage.

P.S. Actually that is one of the molds I hope LLVM/clang might break. clang is implemented as a reusable library theoretically allowing to mix languages. E.g. main source file can be in one language (and parsed by one front-end), but the #includes could be in C (and parsed by the clang).

这篇关于是否有适合同龛为C任何语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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