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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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/xmqq4knca7c6.fsf@xxxxxxxxxxxxxxxxxxxxxx/



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux