The Linux Kernel Is Now VLA (Variable-Length Array) Free

With the in-development Linux 4.20 kernel, it is now effectively VLA-free… The variable-length arrays (VLAs) that can be convenient and part of the C99 standard but can have unintended consequences.
VLAs allow for array lengths to be determined at run-time rather than compile time. The Linux kernel has long relied upon VLAs in different parts of the kernel — including within structures — but going on for months now (and years if counting the kernel Clang’ing efforts) has been to remove the usage of variable-length arrays within the kernel. The problems with them are:
– Using variable-length arrays can add some minor run-time overhead to the code due to needing to determine the size of the array at run-time.
– VLAs within structures is not supported by the LLVM Clang compiler and thus an issue for those wanting to build the kernel outside of GCC, Clang only supports the C99-style VLAs.
– Arguably most


Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/58c6B0H3q9c/scan.php

Original article

Comments are closed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d bloggers like this: