Le 31/01/2010 17:35, Tom Lane a écrit :
> Guillaume Lelarge <guillaume@lelarge.info> writes:
>
>> */
>> do
>> {
>> + const char *values[] = {
>> + my_opts->hostname,
>> + my_opts->port,
>> + my_opts->dbname,
>> + my_opts->username,
>> + password,
>> + "oid2name",
>> + NULL
>> + };
>> +
>> new_pass = false;
>
> Is that really legal C89 syntax?
I don't really know. gcc (4.4.1 release) didn't complain about it,
whereas it complained with a warning for not-legal-syntax when I had the
"new_pass = false;" statement before the array declaration.
> I seem to recall that array
> constructors can only be used for static assignments with older
> compilers.
>
> Also, as a matter of style, I find it pretty horrid that this isn't
> immediately adjacent to the keywords array that it MUST match.
>
I don't find that horrid. AFAICT, that's the only advantage of the
two-arrays method. By the way, it's that kind of code (keywords
declaration separated from values declaration) that got commited in the
previous patch
(http://archives.postgresql.org/pgsql-committers/2010-01/msg00398.php).
I merely used the same code for the other binaries.
--
Guillaume.http://www.postgresqlfr.orghttp://dalibo.com