Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


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?


`={}` in place of `={0}` is the new option in C23.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: