Re: Remove redundant initializations

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove redundant initializations
Date: 2021-06-28 11:40:02
Message-ID: CAApHDvqW49yb6Lhto=DbHr0Ph2fgDcz5ae+TJPY=Nzqbj3+E=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 28 Jun 2021 at 21:59, Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> There are certain parts of code that laboriously initialize every field
> of a struct to (some spelling of) zero, even though the whole struct was
> just zeroed (by makeNode() or memset()) a few lines earlier. Besides
> being redundant, I find this hard to read in some situations because
> it's then very hard to tell what is different between different cases or
> branches.

Just for information, there was a similar proposal in [1]. There were
some arguments for and against the idea. Might be worth reviewing.

David

[1] https://www.postgresql.org/message-id/flat/CAFjFpRdmx2oWdCrYcQuk9CZ7S9iTrKSziC%3D%3D6j0Agw4jdmvLng%40mail.gmail.com#ff36253217d67d5531f5b2017a0dbfd0

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-06-28 11:46:30 Re: Deadlock risk while inserting directly into partition?
Previous Message David Rowley 2021-06-28 11:26:50 Re: Numeric multiplication overflow errors