How about add counted_by attribute for flexible-array?

From: Japin Li <japinli(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: How about add counted_by attribute for flexible-array?
Date: 2024-06-20 10:02:38
Message-ID: ME3P282MB3166210CDE36BD485B703BF6B6C82@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-06-20 10:07:23 Re: Speed up collation cache
Previous Message John Naylor 2024-06-20 10:00:03 Re: 回复: An implementation of multi-key sort