Re: const correctness

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Cc: "Thomas Munro" <munro@ip9.org>, "Robert Haas" <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2011-11-09T23:10:24Z
Lists: pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Thomas Munro <munro@ip9.org> wrote:
>> There is another option: if list_head is changed to take a pointer
>> to const List and return a pointer to non-const ListCell
>> (something I was trying to avoid before), then no XXX_const
>> functions/macros are necessary, and all of the functions from the
>> first patch can keep their 'const', adding const to 930 lines.
 
> Now that you mention it, I think that's better anyway.

IOW, the strchr() trick?  If the C standards committee couldn't find
any better answer than that, maybe we shouldn't expect to either.

In general I don't have an objection to adding "const" to individual
routines, so long as it doesn't create propagating requirements to
const-ify other code.  This may be the only way to do it.

			regards, tom lane