Re: Remove redundant initializations - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Remove redundant initializations
Date
Msg-id EDB8362F-3CF7-4883-A811-F6443481AC63@yesql.se
Whole thread Raw
In response to Remove redundant initializations  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers
> On 28 Jun 2021, at 11:59, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>
> There are certain parts of code that laboriously initialize every field of a struct to (some spelling of) zero, even
thoughthe whole struct was just zeroed (by makeNode() or memset()) a few lines earlier.  Besides being redundant, I
findthis hard to read in some situations because it's then very hard to tell what is different between different cases
orbranches.  The attached patch cleans up most of that.  I left alone instances where there are (nontrivial) comments
attachedto the initializations or where there appeared to be some value in maintaining symmetry.  But a lot of it was
justplain useless code, some clearly copy-and-pasted repeatedly. 

I personally sort of like the initializations of Lists like the one below, even
if redundant, since they then clearly stand out as being Lists.

-    fk_trigger->args = NIL;

Just a matter of personal preference, but I find that those aid readability.

--
Daniel Gustafsson        https://vmware.com/




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Deadlock risk while inserting directly into partition?
Next
From: David Rowley
Date:
Subject: Re: Deadlock risk while inserting directly into partition?