From: Craig Ringer <ringerc@ringerc.id.au>
To: Lionel Elie Mamane <lionel@mamane.lu>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6216: Calling PQconnectdbParams from C++ with a char**
Date: Wed, 21 Sep 2011 07:29:23 +0800
Message-ID: <4E7921D3.7030209@ringerc.id.au> (raw)
In-Reply-To: <201109201605.p8KG5tku049175@wwwmaster.postgresql.org>
References: <201109201605.p8KG5tku049175@wwwmaster.postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: ringerc@ringerc.id.au, lionel@mamane.lu
Subject: Re: BUG #6216: Calling PQconnectdbParams from C++ with a char**
In-Reply-To: <4E7921D3.7030209@ringerc.id.au>
References: <201109201605.p8KG5tku049175@wwwmaster.postgresql.org> <4E7921D3.7030209@ringerc.id.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox