Re: A couple items on TODO

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: A couple items on TODO
Дата
Msg-id Pine.LNX.4.30.0108241619080.677-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: A couple items on TODO  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane writes:

> Yeah, people have started to use 'const' in new code, but the older
> stuff doesn't use it, which means that the net effect is probably
> more annoyance than help.  I'm afraid that if we attack this in an
> incremental way, we'll end up with code that may have a lot of const
> markers in the declarations, but the actual code is riddled with
> explicit casts to remove const because at one time or another that
> was necessary in a particular place.
>
> Can anyone think of a way to get from here to there without either
> a lot of leftover cruft, or a "big bang" massive changeover?

What I usually do if I feel a parameter could be made const is to
propagate the change as far as necessary to the underlying functions.
From time to time this turns out to be impossible at some layer.  BUT:
This is an indicator that you really don't know whether the value is const
so you shouldn't declare it thus.

IMHO, a better project than putting const qualifiers all over interfaces
that you are not familiar with would be to clean up all the -Wcast-qual
warnings.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [PATCHES] encoding names
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: User locks code