Re: Coding style point: "const" in function parameter declarations - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: Coding style point: "const" in function parameter declarations
Date
Msg-id BANLkTi=MEtaYnH7DqRva=9Dqoq_FyeZ7=g@mail.gmail.com
Whole thread Raw
In response to Coding style point: "const" in function parameter declarations  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Coding style point: "const" in function parameter declarations
List 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 by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Coding style point: "const" in function parameter declarations
Next
From: "Kevin Grittner"
Date:
Subject: Re: Repeated PredicateLockRelation calls during seqscan