How about add counted_by attribute for flexible-array? - Mailing list pgsql-hackers

From Japin Li
Subject How about add counted_by attribute for flexible-array?
Date
Msg-id ME3P282MB3166210CDE36BD485B703BF6B6C82@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: 回复: An implementation of multi-key sort
Next
From: John Naylor
Date:
Subject: Re: Speed up collation cache