by artagnon on 1/10/24, 2:58 PM with 55 comments
by loup-vaillant on 1/10/24, 9:08 PM
If you do a lot of meta-programming… why not used a more principled approach like Lex & Yacc? Why not go all the way to design mini-languages and compile them to C? Or design C extensions and compile them to C? You can still have good debugging support with line markers. https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
by TwentyPosts on 1/10/24, 4:28 PM
I find it hard not to view stuff like this as a "if Rust gets to be in the kernel, then so should C++!".
by synergy20 on 1/10/24, 8:41 PM
by charcircuit on 1/10/24, 9:01 PM
by kwant_kiddo on 1/10/24, 9:46 PM
I don't think that Linus will allow this since he just commented that he will allow rust in drivers and major subsystems [1].
would have hoped see more answers or see something in here from actual kernel developers.
0: https://github.com/gcc-mirror/gcc/commit/5329b59a2e13dabbe20...
by azamba on 1/10/24, 8:55 PM
by jraph on 1/10/24, 9:42 PM
by xorcist on 1/10/24, 11:09 PM
However, hpa seems to be the crazy genius type, so maybe it's all for real.
The thing I'd like to know is, given that the kernel is written in "kernel C", a shared culture about how C should be used together with a hairy mountain of macros, why not make kernel-C a proper language?
It's probably just a number of extensions away. Together with some rules about code generation, it could make for a fairly neat dialect of C that would be much easier to use and understand. It would also pave the way for further experiments with compile time guarantees about soundness of isolated sections of the code.
Because, and we should be honest about this, going any C++-like route would impact the long term quality of submitted code. There should be no technical reason for this, but that does not make it something that should be turned a blind eye on.
by neva_krien on 1/18/24, 11:06 AM
gives me some doubts if I should put my time into learning c or not. a lot of the tech I care about uses c++ (i want to work in ANNs) and true the kernels are basically in c but the code is c++.
by crq-yml on 1/10/24, 9:53 PM
by 6R1M0R4CL3 on 1/12/24, 10:21 AM
by binary132 on 1/11/24, 4:46 AM
by Gow8876 on 1/11/24, 7:15 AM
by bfrog on 1/11/24, 12:55 AM
C may have technical challenges but seemingly personal preferences are much more limited, just like the language. That helps large projects move forward.