Re: Using the new libpq connection functions in PostgreSQL binaries

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using the new libpq connection functions in PostgreSQL binaries
Date: 2010-01-31 17:42:50
Message-ID: 4B65C11A.7010405@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le 31/01/2010 17:35, Tom Lane a écrit :
> Guillaume Lelarge <guillaume(at)lelarge(dot)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.org
http://dalibo.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2010-01-31 17:51:05 Re: Using the new libpq connection functions in PostgreSQL binaries
Previous Message Magnus Hagander 2010-01-31 17:38:12 Re: odd output in initdb