Re: const correctness - Mailing list pgsql-hackers

From Tom Lane
Subject Re: const correctness
Date
Msg-id 22416.1320880224@sss.pgh.pa.us
Whole thread Raw
In response to Re: const correctness  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: const correctness
List 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


pgsql-hackers by date:

Previous
From: Steve Singer
Date:
Subject: pg_dump 9.1.1 hanging (collectSecLabels gets 0 labels)
Next
From: Simon Riggs
Date:
Subject: Re: heap vacuum & cleanup locks