←back to thread

232 points pjmlp | 3 comments | | HN request time: 1.227s | source
1. fuhsnn ◴[] No.43535105[source]
If you are taking notes, add `-fzero-init-padding-bits=all` to the list, without this flag, GCC 15 onwards will not zero-initialize a full union if you wrote pre-C23 style ={0} and the largest member is not the first one. `-ftrivial-auto-var-init` cannot help this case. https://godbolt.org/z/7zKccfnea
replies(1): >>43539467 #
2. naitgacem ◴[] No.43539467[source]
I have been always stuck with C99, what is the "post" C23 way that will zero initialize a full union?

Or am I misunderstanding this?

replies(1): >>43539815 #
3. dzaima ◴[] No.43539815[source]
`={}` in place of `={0}` is the new option in C23.