From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
---|---|
To: | Lionel Elie Mamane <lionel(at)mamane(dot)lu> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6216: Calling PQconnectdbParams from C++ with a char** |
Date: | 2011-09-20 23:29:23 |
Message-ID: | 4E7921D3.7030209@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 21/09/2011 12:05 AM, Lionel Elie Mamane wrote:
> The following bug has been logged online:
>
> Bug reference: 6216
> Logged by: Lionel Elie Mamane
> Email address: lionel(at)mamane(dot)lu
> PostgreSQL version: 9.1.0
> Operating system: Debian GNU/Linux
> Description: Calling PQconnectdbParams from C++ with a char**
> Details:
>
> In C++, a "char**" value is not convertible to a "const char**" value,
> because that is not safe (see
> http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.17).
>
> This means one cannot call libpq's PQconnectdbParams and friends passing
> them a "char**" value for keywords and/or values, as these arguments are
> declared "const char**".
>
> So please apply this patch, which declares them "char const* const*"
> instead, which is:
> - equivalent to "const char * const*"; use that one if you prefer
Yeah, this really annoyed me when I was working with C libraries from C++.
+1 from me; this should be applied.
Lionel: Can I get you to add the patch to the commitfest app?
https://commitfest.postgresql.org/
I'll accept review of it once you do and flag it as ready for committer
so we can streamline its inclusion.
As for wording: my *personal* preference is "const char * const" but I
don't know what the opinions of those who work with the code day-to-day are.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-09-20 23:43:25 | Re: BUG #6216: Calling PQconnectdbParams from C++ with a char** |
Previous Message | Merlin Moncure | 2011-09-20 23:29:01 | Re: BUG #6216: Calling PQconnectdbParams from C++ with a char** |