In a recent discussion among the nucleus developers of Linux, the prospects of using modern C++ code in addition to the current use of the SI language and assembler inserts, as well as the promotion of the Rust language, were reinforced. This topic was initially raised in 2018 by Red Hat as an April Fool’s joke, where they published a set of 45 patches for the use of C++ templates, inherited classes, and overload functions in the nucleus code.
The initiative to continue this discussion was taken by Hans Peter Anvin, one of the key developers of Intel and creator of projects like Syslinux, Klibc, and Lanana. Anvin, who has been involved in the nucleus development since 1999, believes that the C++ language has advanced significantly and is now better than C for developing operating system kernels. He mentions that the possibilities for which specific GCC extensions were required can now be easily implemented using standard C++. Additionally, using C++ will improve infrastructure without requiring a global code change. Anvin recommends using at least the C++ 14 specification, which includes the necessary means of metaprogramming, and prefers the use of the C++ 20 specification, which supports concepts that can prevent many errors.
Anvin argues that C++ is more preferable than Rust, as Rust has a significantly different syntax from the C language, is unfamiliar to current core developers, and does not allow for gradual code rewriting. Unlike Rust, C++ code can be gradually translated from C, as C code can be compiled as C++. Supporters of using C++ in the nucleus include Irji Slaby from Suse and David Howells from Red Hat.