Subject: Re: [PATCH v2 1/3] merge-base, xdiff: zero out xpparam_t structures

From: Junio C Hamano <[email-masked]>
Date: Mon, 12 Oct 2020 10:09:10 -0700

Johannes Schindelin <[email-masked]> writes:

>>  	xpparam_t xpparam;
>> +
>> +	memset(&xpparam, 0, sizeof(xpparam));
>
> A slightly more elegant way to do this would be
>
> 	xpparam_t xpparam = { 0l };
>
> Or even
>
> 	xpparam_t xpparam = XPPARAM_T_INIT;
>
> with
>
> 	#define XPPARAM_T_INIT { 0l, NULL, 0 }
>
> in `xdiff/xdiff.h`.

Let's not suggest any of the above.

I think we had a recent thread [*1*] on which we agreed that "{ 0 }"
is the way to spell "a naturally zero" initialization like this one,
if we were to spell it out.

TBH, I'd say that memset() is also OK as-is in this codebase as an
established way (git grep 'memset([^,]*, 0, sizeof' gives too many
hits).

Thanks.

[Reference]

*1* https://lore.kernel.org/git/[email-masked]/