Re: Coding style point: "const" in function parameter declarations

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Coding style point: "const" in function parameter declarations
Дата
Msg-id BANLkTi=MEtaYnH7DqRva=9Dqoq_FyeZ7=g@mail.gmail.com
обсуждение исходный текст
Ответ на Coding style point: "const" in function parameter declarations  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Coding style point: "const" in function parameter declarations  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Jun 21, 2011 at 5:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Declarations like "const structtype *param" are fine, because those
> create a real, enforced contract on what the function can do to data
> that is visible to its caller.  But I don't see any value at all in
> const-ifying the parameter itself.
>
> Comments?

What about making a separate typedef for that (like ConstRelation)?
Maybe the const contract is useful, and aren't there occasional
performance enhancements the compiler can make when it function
arguments are const?

merlin


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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Coding style point: "const" in function parameter declarations
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Repeated PredicateLockRelation calls during seqscan