Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()? - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Date
Msg-id 859822.1734796591@sss.pgh.pa.us
Whole thread Raw
In response to libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?  (Jeroen Vermeulen <jtvjtv@gmail.com>)
Responses Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
List pgsql-interfaces
Jeroen Vermeulen <jtvjtv@gmail.com> writes:
> Any objections to changing these two libpq functions' PGresult* parameters
> to be const?

> So "char * PQcmdStatus(PGresult *)" would become "char *PQcmdStatus(const
> PGresult *)", and "char *PQcmdTuples(PGresult *)" would become "char
> *PQcmdTuples(const PGresult *)".

Both of those return pointers to res->cmdStatus, so it would not make
any sense to const-ify the argument unless you also const-ify the
result; which would cause compiler warnings for users.  I'm pretty
sure we've explicitly rejected making this change for that reason.

            regards, tom lane



pgsql-interfaces by date:

Previous
From: Jeroen Vermeulen
Date:
Subject: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?
Next
From: Jeroen Vermeulen
Date:
Subject: Re: libpq: make PGresult* "const" in PQcmdStatus()/PQcmdTuples()?