Re: flexible array members

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: flexible array members
Date: 2011-06-15 22:19:06
Message-ID: 5610.1308176346@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Is this a route we want to go down?

> - GISTENTRY vector[1]; /* variable-length array */
> + GISTENTRY vector[FLEXIBLE_ARRAY_MEMBER];

Yes, I was thinking about the same trick after noting these warnings on
Fedora 15, although personally I'd name the macro VARIABLE_LENGTH_ARRAY.

> One thing that is a bit concerning is that throwing more flexible array
> members around the code wherever variable-length arrays are used results
> in crash and burn. Probably some places are using sizeof or offsetof on
> these structures in incompatible ways. So each place would have to be
> examined separately.

Hmm, that's nasty. But from a code-documentation standpoint I think
this is a useful improvement, so it seems worth doing the work to clean
things up.

(I do recall a number of places that assume that sizeof() includes a
single array element ...)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-06-15 23:02:47 Re: On-the-fly index tuple deletion vs. hot_standby
Previous Message Simon Riggs 2011-06-15 21:54:56 Re: FK NOT VALID can't be deferrable?