> On Apr 23, 2024, at 14:04, Joseph Myers <josmy...@redhat.com> wrote: > > On Fri, 19 Apr 2024, Qing Zhao wrote: > >> +The size of the union is as if the flexiable array member were omitted >> +except that it may have more trailing padding than the omission would imply. > > "trailing padding" is more a concept for structures than for unions (where > padding depends on which union member is active). But I suppose it's > still true that the union can be larger than without the flexible member, > because of alignment considerations. > > union u { char c; int a[]; }; > > needs to be sufficiently aligned for int, which means the size is a > multiple of the size of int, whereas if the flexible array member weren't > present, the size could be 1 byte.
Yes, that’s exact what I tried to include in the documentation part -:) And I have a testing case for this in the patch. However, I am not very confident on the wording of the doc, is the current wording good enough for this? Or do you have any suggestion on how to make it better? Thanks a lot! Qing > > -- > Joseph S. Myers > josmy...@redhat.com >