On Mon, Mar 18, 2024 at 05:34:42PM -0400, Rich Felker wrote:
> If the clang interpretation is going to be this, we can just reorder
> the union members so that the largest one is first.
Another option is to utilize implicit static initializer rules:
| if it is a union, the first named member is initialized (recursively)
| according to these rules, and any padding is initialized to zero bits;
So something like:
static union u zero;
union u u = zero;
Though, the "padding bits" part was added in C11 and wasn't present in
C99 in case you want to be pedantic about C99 conformance.
- NRK