news.volyx.in

Moving the Linux Kernel to Modern C (lwn.net)

683 points by chmaynard · 1664 days ago · 345 comments on HN

Article summary

The Linux kernel is considering moving from the C89 standard to a more modern version, such as C99 or C11, to take advantage of features like block-level variable declarations. This change is motivated by the need to prevent speculative-execution vulnerabilities and make the code more secure. The discussion started with a patch series aimed at preventing these vulnerabilities, but it led to a broader conversation about the kernel's use of outdated C standards. A move to C11 might happen in the next kernel release, but it could also reveal unexpected issues in the kernel code.

Main themes

  • Linux kernel development
  • C standards and compatibility
  • Programming language choice
  • Code security and maintainability
  • Compiler modifications and customization
  • Rust and C++ as alternatives to C

What commenters say

  • The Linux kernel's move to a modern C standard is long overdue and will improve the code's security and maintainability.
  • Modifying the compiler to support specific kernel needs could be a better solution than changing the C standard.
  • C++ is a viable alternative to C for the kernel, despite its perceived complexity and undesirable characteristics.
  • Rust is gaining support within the Linux kernel and could potentially replace C in the future.
  • The kernel's reliance on GCC extensions makes it non-standards compliant, but this is not necessarily a problem.
  • A customized language for the kernel could provide exactly what is needed, without the undesirable features of existing languages.
  • C++'s complexity is a feature, not a bug, and its metaprogramming capabilities make it a powerful tool.
  • The pace of C standard revisions is slow because the language is stable and well-established, and changes are only made when necessary.