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.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to