Article 6P9BX Silva: How to use the new counted_by attribute in C (and Linux)

Silva: How to use the new counted_by attribute in C (and Linux)

by
corbet
from LWN.net on (#6P9BX)
Gustavo A. R. Silva describesthe path to safer flexible arrays in the kernel, thanks to thecounted_by attribute supported by Clang18 and GCC15.

There are a number of requirements to properly use thecounted_by attribute. One crucial requirement is that thecounter must be initialized before the first reference to theflexible-array member. Another requirement is that the array mustalways contain at least as many elements as indicated by thecounter.

See also: this article from 2023.

External Content
Source RSS or Atom Feed
Feed Location http://lwn.net/headlines/rss
Feed Title LWN.net
Feed Link https://lwn.net/
Reply 0 comments