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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Chapman Flack <chap(at)anastigmatix(dot)net>, Ashwin Agrawal <aagrawal(at)pivotal(dot)io>, 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-18 12:18:20
Message-ID: 20191018121820.GY6962@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Thomas Munro (thomas(dot)munro(at)gmail(dot)com) wrote:
> On Tue, Oct 8, 2019 at 11:09 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > I am personally still in the camp of people advocating the use of
> > macro for this purpose. It is quite possible after reading your
> > points, some people might change their opinion or some others also
> > share their opinion against using a macro in which case we can drop
> > the idea of using a macro.
>
> -1 for these macros.

Agreed.

> These are basic facts about the C language. I hope C eventually
> supports {} like C++, so that you don't have to think hard about
> whether the first member is another struct, and recursively so … but
> since the macros can't help with that problem, what is the point?

I realize that I need to don some fireproof gear for suggesting this,
but I really wonder how much fallout we'd have from just allowing {} to
be used.. It's about a billion[1] times cleaner and more sensible than
using {0} and doesn't create a dependency on what the first element of
the struct is..

Thanks,

Stephen

1: Detailed justification not included intentionally and is left as an
exercise to the reader.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2019-10-18 12:21:20 Re: [Patch proposal] libpq portal support
Previous Message Alvaro Herrera 2019-10-18 12:07:58 Re: Clean up MinGW def file generation