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@mamane.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