Hi, hackers

When I read [1], I think the "counted_by" attribute may also be valuable for
PostgreSQL.

The 'counted_by' attribute is used on flexible array members. The argument for
the attribute is the name of the field member in the same structure holding
the count of elements in the flexible array. This information can be used to
improve the results of the array bound sanitizer and the
'__builtin_dynamic_object_size' builtin [2].

It was introduced in Clang-18 [3] and will soon be available in GCC-15.

[1] 
https://embeddedor.com/blog/2024/06/18/how-to-use-the-new-counted_by-attribute-in-c-and-linux/
[2] https://reviews.llvm.org/D148381
[3] https://godbolt.org/z/5qKsEhG8o

-- 
Regrads,
Japin Li


Reply via email to