Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Alex Goncharov <alex-goncharov(at)comcast(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved
Date: 2012-01-15 19:52:01
Message-ID: 1326657121.32048.3.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On tis, 2012-01-10 at 14:10 -0500, Alex Goncharov wrote:
> | Note that const PGresult * would only warn against changing the
> | fields
>
> It would not warn, it would err (the compilation should fail).

No, const violations generally only produce warnings.

>
> | of the PGresult struct. It doesn't do anything about changing the data
> | pointed to by pointers in the PGresult struct. So what you are saying
> | doesn't follow.
>
> By this logic, passing 'const struct foo *' doesn't have any point and
> value, for any function.

It pretty much doesn't.

> But we know that this is done (and thank you
> for that) in many cases -- a good style, self-documentation and some
> protection.

I'm not disagreeing, but I'm pointing out that it won't do what you
expect.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gabriele Bartolini 2012-01-15 20:02:56 Re: Dry-run mode for pg_archivecleanup
Previous Message Joachim Wieland 2012-01-15 18:01:43 patch for parallel pg_dump