On Tue, 18 Nov 2025, Qing Zhao wrote:

> At the same time, shall we support the following with -fms-extensions:
> 
> /* -fms-extensions */
> 
> struct ids
> {
>   int length_ad;
>   int length_na;
> };
> 
> struct person
> {
>   int age;
>   int weight;
>   struct ids;    // Anonymous structure, no name needed
>   char *address __attribute__ ((counted_by (length_ad)));
>   char name[]  __attribute__ ((counted_by (length_na)));
> } *Jim;
> 
> i.e, in the above, the counted_by fields for Pointer “address” and FAM “name” 
> are in the anonymous 
> structure “struct ids” which is not inlined into the “struct person”. 
> 
> Any idea on this?

Yes, supporting such outward-to-inward counted_by references makes sense 
in a way that inward-to-outward references don't (because checking the 
validity of outward-to-inward references doesn't depend on anything 
unknown at the end of the structure definition).

-- 
Joseph S. Myers
[email protected]

Reply via email to