Re: const correctness

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: const correctness
Дата
Msg-id CA+TgmoYyj=95crwo0nMXfA2ddzhHDoqs+=x0-fKPWjQLf3JjFQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: const correctness  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: const correctness  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
On Wed, Nov 9, 2011 at 2:35 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> Robert Haas <robertmhaas@gmail.com> wrote:
>
>> If it doesn't uglify the code, there aren't any negatives.  I'm
>> just saying we may not be able to get very far before we run up
>> against that issue.  For example, in the OP, Thomas wrote:
>>
>> 7.  I made a list_head_const function, which can be used used to
>>     get a pointer to the head cell when you have a pointer to
>>     const List; I needed that so I could make foreach_const and
>>     forboth_const; they were needed to be able to make
>>     list_member, _equalList and various other list-visiting
>>     functions work with const List objects.
>>
>> So that's already duplicating list_head, foreach, and forboth.
>
> OK, I failed to pick up on that properly.  With that stripped out,
> you get the attached patch, which does nothing but add "const" to
> 661 lines.  It still applies cleanly, builds with no warnings, and
> passes regression tests.

So what happens when someone wants to use list_nth in one of the
outfuncs?  Would we then rip all these back out?  Or would we then
bite the bullet and duplicate the code?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: a modest improvement to get_object_address()
Следующее
От: Robert Haas
Дата:
Сообщение: Re: a modest improvement to get_object_address()