Subj : Silva: How to use the new counted_by attribute in C (and Linux) To : All From : LWN.net Date : Wed Jul 17 2024 15:15:06 Silva: How to use the new counted_by attribute in C (and Linux) Date: Wed, 17 Jul 2024 14:09:10 +0000 Description: Gustavo A. R. Silva describes the path to safer flexible arrays in the kernel , thanks to the counted_by attribute supported by Clang18 and GCC15. There are a number of requirements to properly use the counted_by attribute. One crucial requirement is that the counter must be initialized before the first reference to the flexible-array member. Another requirement is that the array must always contain at least as many elements as indicated by the counter. See also: this article from 2023. ====================================================================== Link to news story: https://lwn.net/Articles/982275/ --- Mystic BBS v1.12 A47 (Linux/64) * Origin: tqwNet UK HUB @ hub.uk.erb.pw (1337:1/100) .