Re: flexible array members - Mailing list pgsql-hackers

From Tom Lane
Subject Re: flexible array members
Date
Msg-id 5610.1308176346@sss.pgh.pa.us
Whole thread Raw
In response to flexible array members  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: flexible array members
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.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


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: FK NOT VALID can't be deferrable?
Next
From: Simon Riggs
Date:
Subject: Re: On-the-fly index tuple deletion vs. hot_standby