Re: [PATCH 1/4] C: s/0/NULL/ for pointer type
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 24, 2020, 01:54 UTC
- Message-ID
- <xmqq8silejib.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200424010924.GF1949@danh.dev>
Danh Doan <congdanhqx@gmail.com> writes:
> So, to follow that idiom, this patch should be changed, too? > https://lore.kernel.org/git/nycvar.QRO.7.76.6.2004101604210.46@tvgsbejvaqbjf.bet/
I didn't look at that patch carefully, but it seems that it changes
struct foo variable_to_be_initialized = {};into various forms, e.g.
struct foo variable_to_be_initialized = { NULL };
struct foo variable_to_be_initialized = { { NULL } };depending on the actual shape of 'foo', and that old thread explains that it is sufficient to consistently write "= { 0 };".
Having said that, if I recall correctly, Dscho suggested even larger style fixes to the code, so if that were to happen, the above initializer fix may just be lost in the noise ;-)
Thanks.
Show 12 quoted lines
> +Cc: Dscho and Han-Wen > >> > [Luc, this topic came up on the sparse and kernel mailing-lists at one >> > point, but I didn't get around to posting my patch to the list - something >> > came up. Hopefully, I will find some time to find it and post it soon.] >> >> >> [References] >> >> *1* >> >> https://lore.kernel.org/git/e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com/