Re: [PATCH 2/5] *.[ch] *_INIT macros: use { 0 } for a "zero out" idiom
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 27, 2021, 02:27 UTC
- Message-ID
- <CAPig+cRBPVpa4+2jm0X-u0Ki8bmihS4dycj9RLwf0Mwx+zjOKQ@mail.gmail.com>
- In-Reply-To
- <patch-2.5-d612e7df7a5-20210927T003330Z-avarab@gmail.com>
On Sun, Sep 26, 2021 at 8:40 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 5 quoted lines
> In C it isn't required to specify that all members of a struct are
> zero'd out to 0, NULL or '\0', just providing a "{ 0 }" will
> accomplish that.
>
> Let's also change change code that provided N zero'd fields to justs/change change/change/
Show 7 quoted lines
> provide one, and change e.g. "{ NULL }" to "{ 0 }" for
> consistency. I.e. even if the first member is a pointer let's use "0"
> instead of "NULL". The point of using "0" consistently is to pick one,
> and to not have the reader wonder why we're not using the same pattern
> everywhere.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>