Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved
Date
Msg-id 1326657121.32048.3.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved  (Alex Goncharov <alex-goncharov@comcast.net>)
List 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.




pgsql-hackers by date:

Previous
From: Joachim Wieland
Date:
Subject: patch for parallel pg_dump
Next
From: Gabriele Bartolini
Date:
Subject: Re: Dry-run mode for pg_archivecleanup