RE: Proposal: Make use of C99 designated initialisers for nulls/values arrays

From: "Smith, Peter" <peters(at)fast(dot)au(dot)fujitsu(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Nelson <joe(at)begriffs(dot)com>
Cc: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Date: 2019-10-03 06:16:44
Message-ID: 201DD0641B056142AC8C6645EC1B5F62014B91E62F@SYD1217
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----Original Message-----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> Sent: Thursday, 3 October 2019 1:46 AM

> Right. I think that in general it's bad practice for an initializer to not specify all fields/elements of the target.
> It is okay in the specific case that we're substituting for a memset(..., 0, ...).
> Perhaps we could make this explicit by using a coding style like
>
>/* in c.h or some such place: */
>#define INIT_ALL_ZEROES {0}
>
>/* in code: */
> Datum values[N] = INIT_ALL_ZEROES;

The patch has been updated per your suggestion. Now using macros for these partial initialisers.

Please see attachment.

Kind Regards
---
Peter Smith
Fujitsu Australia

Attachment Content-Type Size
c99_init_nulls_3.patch application/octet-stream 85.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2019-10-03 06:35:15 Re: Minimal logical decoding on standbys
Previous Message Natarajan R 2019-10-03 05:23:38 Regarding extension