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

From: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Date: 2019-10-21 17:35:49
Message-ID: CAMsGm5cKhq-LGUjTopS4BpEUa7YMjon_Lbv2kyfmgkhWzXAefA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 21 Oct 2019 at 11:46, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:

>
> I would favor {} in a heartbeat if it were standard, because that
> sucker is an idiom.
>
> Failing that, though, I think I still favor the macro, because
> question (1) seems less fuzzy than question (2), and on "clear",
> the macro wins.
>

Is it possible to define the macro to be {} where supported and {0} where
needed? Something like:

#if ...
#define INIT_ALL_ELEMS_ZERO {}
#else
#define INIT_ALL_ELEMS_ZERO {0}
#endif

Then it's clear the 0 is just there to make certain compilers happy and
doesn't have any actual meaning.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Nelson 2019-10-21 18:03:07 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays
Previous Message vignesh C 2019-10-21 17:34:40 Re: Ordering of header file inclusion