MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
attribute
Recherche

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

mercredi 17 juillet 2024, 16:09 , par LWN.net
Gustavo A. R. Silva describes
the path to safer flexible arrays in the kernel, thanks to the
counted_by attribute supported by Clang 18 and GCC 15.

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.
https://lwn.net/Articles/982275/

Voir aussi

News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Date Actuelle
dim. 22 déc. - 13:35 CET