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

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: Ashwin Agrawal <aagrawal(at)pivotal(dot)io>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jacob Champion <pchampion(at)pivotal(dot)io>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Date: 2019-10-04 18:05:41
Message-ID: 4f4852b9-0ed5-b84c-03ae-ebc7725219ea@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/4/19 1:44 PM, Ashwin Agrawal wrote:

> macro exist in first place will be hard to remember. So, irrespective
> in long run, {0} might get used in code and hence seems better
> to just use {0} from start itself instead of macro/wrapper on top.
>
> Plus, even if someone starts out with thought {1} sets them all to ones,
> I feel will soon realize by exercising the code isn't the reality.

I wish ISO C had gone the same place gcc (and C++ ?) went, and allowed
the initializer {}, which would eliminate any chance of it misleading
a casual reader.

If that were the case, I would be +1 on just using the {} syntax.

But given that the standard is stuck on requiring a first element,
I am +1 on using the macro, just to avoid giving any wrong impressions,
even fleeting ones.

Regards,
-Chap

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-10-04 18:32:51 Re: tableam vs. TOAST
Previous Message Ashwin Agrawal 2019-10-04 17:44:13 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays