6 ms·
I think none of your points are really set in stone. * The kernel already contains some C++ which (if you ask C programmers) is not C. And many C programmers a
by std_throwawayay 8y ago
I think none of your points are really set in stone.
* The kernel already contains some C++ which (if you ask C programmers) is not C. And many C programmers are more likely to accept Rust than having to deal with C++.
* AFAIK there is not gcc front-end for Rust yet but LLVM tools can compile the kernel, too. When Rust stabilizes gcc support may come, too.
* The barrier for entry could be lowered by using Rust for Rust programmers if it is employed in some specific modules. The resulting code could be more clear. Not everything in the kernel is pointer pointing and bit shuffling.
* The number of architectures that Rust supports are growing daily.
- jononor 8y agoWhere in the (mainline) kernel is there C++ code?
- std_throwawayay 8y agoI could swear that I read that they start allowing some C++ contributions. But with a search in the kernel source I could not come up with any evidence. If there is any C++ code in the kernel they hid it well.
- scoopr 8y agoYou may be thinking of GCC
- milkey_mouse 8y ago> The [Linux] kernel already contains some C++ Are you sure? I don't think the kernel even compiles with a C++ compiler [1]. Also, I just ran cloc on my linux repo and didn't get any actual C++ code. Perhaps some external kernel modules are written in C++, but that seems like a bad idea too [2]. [1] https://www.phoronix.com/scan.php?page=news_item&px=45-Linux-Kernel-CXX-Patches https://www.phoronix.com/scan.php?page=news_item&px=45-Linux... [2] https://www.threatstack.com/blog/c-in-the-linux-kernel https://www.threatstack.com/blog/c-in-the-linux-kernel
- std_throwawayay 8y agoThat [1] was what I remembered. They were preparing for C++. But obviously it didn't get as far as actually including C++ code in the mainline kernel. Maybe it was a preparation in order to allow experimenting with C++ in the kernel.
- porpoisely 8y agoPretty sure the linux kernel is exclusively C. Actually the major OS kernels are pretty much all C - Windows, FreeBSD, MacOS and other BSD derivatives. The GNU software and utils could be written in C++.
- int_19h 8y agoMacOS is not a BSD derivative when it comes to kernel. And I'm pretty sure Windows has some C++ in kernel space. It might be limited (no exceptions etc), but that's another matter.