Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays
Date
Msg-id 20191018121820.GY6962@tamriel.snowman.net
Whole thread Raw
In response to Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays
List pgsql-hackers
Greetings,

* Thomas Munro (thomas.munro@gmail.com) wrote:
> On Tue, Oct 8, 2019 at 11:09 PM Amit Kapila <amit.kapila16@gmail.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.

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Clean up MinGW def file generation
Next
From: Craig Ringer
Date:
Subject: Re: [Patch proposal] libpq portal support