Re: const correctness

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Thomas Munro" <munro(at)ip9(dot)org>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: const correctness
Date: 2011-11-09 23:10:24
Message-ID: 22416.1320880224@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Thomas Munro <munro(at)ip9(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-11-09 23:10:52 Re: heap vacuum & cleanup locks
Previous Message Steve Singer 2011-11-09 22:59:59 pg_dump 9.1.1 hanging (collectSecLabels gets 0 labels)