Re: [HACKERS] flexible array members
On ons, 2011-06-15 at 18:19 -0400, Tom Lane wrote: Peter Eisentraut pete...@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. This macro is provided by Autoconf and it appears to be using the standard's terminology. Actually, the term variable-length array appears to refer to another C99 feature, namely this one: void foo(int n) { bar int[n]; do_something(); } -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] flexible array members
On Thu, 16 Jun 2011 22:49:45 +0300, Peter Eisentraut pete...@gmx.net wrote: This macro is provided by Autoconf and it appears to be using the standard's terminology. commit dbbba5279f66f95805c1e084e6f646d174931e56 refs/heads/master Author: Peter Eisentraut pete...@gmx.net Date: Thu Jun 16 22:39:09 2011 +0300 Periodically checking my VS2010 patch I noticed that this one broke Visual Studio builds. At least mine and chough http://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=choughbr=HEAD in the build farm - I expect others to follow once they rebuild. error C2065: 'FLEXIBLE_ARRAY_MEMBER' : undeclared identifier error C2057: expected constant expression Regards, Brar
Re: [HACKERS] flexible array members
Peter Eisentraut pete...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers