Re: const correctness

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <peter@2ndquadrant.com>
Cc: Thomas Munro <munro@ip9.org>, pgsql-hackers@postgresql.org
Date: 2011-11-09T15:49:04Z
Lists: pgsql-hackers
Peter Geoghegan <peter@2ndquadrant.com> writes:
> On 9 November 2011 15:24, Tom Lane <tgl@sss.pgh.pa.us> wrote:.
>> If you go down this road you soon start needing duplicate functions
>> for no other reason than that one takes/returns "const" and one doesn't.

> Why would you have to do that?

list_nth is an example.  Now admittedly you can hack it, in the same
spirit as the C library functions that are declared to take const
pointers and return non-const pointers to the very same data; but that
hardly satisfies anyone's idea of const cleanliness.  In particular
it doesn't fix what Peter E. was on about, which was getting rid of
cast-away-const warnings, since such a function will have to do that
internally.

			regards, tom lane