> On Feb 23, 2023, at 5:04 PM, Qing Zhao via Gcc-patches 
> <gcc-patches@gcc.gnu.org> wrote:
> 
> 
> 
>> On Feb 23, 2023, at 4:24 PM, Joseph Myers <jos...@codesourcery.com> wrote:
>> 
>> On Thu, 23 Feb 2023, Qing Zhao via Gcc-patches wrote:
>> 
>>> +@item
>>> +The structure with a C99 flexible array member is the field of
>>> +another union, for example:
>>> +
>>> +@smallexample
>>> +struct flex1  @{ int length1; char data1[]; @}
>>> +struct flex2  @{ int length2; char data2[]; @}
>>> +
>>> +union out_flex @{ struct flex1 flex_data1; struct flex2 flex_data2; @}
>> 
>> I don't think this is an extension; structures with flexible array members 
>> are OK in unions in standard C.
> 
> Thanks for the info.
> 
> Just checked the small testing case with -Wpedantic, Yes, it’s accepted 
> without any warning.
> Will delete this item from the doc. And send the new patch soon.

But the following:

struct flex1  { int length1; char data1[]; };
struct flex2  { int length2; char data2[]; };
union union_flex { struct flex1 f1; struct flex2 f2; };  /* this is C standard. 
 */

struct out_flex { int n; union union_flex flex_data1;};  /* this is GNU 
extension.  */

Should add this item into the documentation?

Qing

> 
> Thanks.
> 
> Qing
>> 
>> -- 
>> Joseph S. Myers
>> jos...@codesourcery.com

Reply via email to