Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Peter Geoghegan
On 23 June 2011 00:37, Greg Stark wrote: > Hm. I have to say the single most confusing thing about the Postgres > source that took me a *long* time to get over was remembering that > some of the typedefs were already pointers and some weren't. It seems > silly now but when I was trying to understa

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Tom Lane
Greg Stark writes: > On Wed, Jun 22, 2011 at 5:41 PM, Tom Lane wrote: >> If we were thinking of moving in that direction, I would argue that >> we should get rid of typedef'd pointers altogether, ie, change >> "Relation" to be a typedef for the struct and write "Relation *rel" >> not "Relation re

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Greg Stark
On Wed, Jun 22, 2011 at 5:41 PM, Tom Lane wrote: > If we were thinking of moving in that direction, I would argue that > we should get rid of typedef'd pointers altogether, ie, change > "Relation" to be a typedef for the struct and write "Relation *rel" > not "Relation rel". Hm. I have to say the

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Robert Haas
On Wed, Jun 22, 2011 at 12:41 PM, Tom Lane wrote: > Merlin Moncure writes: >> On Tue, Jun 21, 2011 at 5:51 PM, Tom Lane 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 i

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Tom Lane
Merlin Moncure writes: > On Tue, Jun 21, 2011 at 5:51 PM, Tom Lane 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-

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Merlin Moncure
On Tue, Jun 21, 2011 at 5:51 PM, Tom Lane 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. >

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-22 Thread Heikki Linnakangas
On 22.06.2011 02:58, Dan Ports wrote: On Tue, Jun 21, 2011 at 06:51:20PM -0400, Tom Lane wrote: I find this to be poor style, and would like to see if there's any support for getting rid of the "const" keywords. I'm in favor of removing them too. Ok, I've removed all the useless const qualif

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-21 Thread Heikki Linnakangas
On 22.06.2011 01:51, Tom Lane wrote: I notice that the SSI code is rather heavily invested in function declarations like this: extern bool PageIsPredicateLocked(const Relation relation, const BlockNumber blkno); I find this to be poor style, and would like to see if there's any support for get

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-21 Thread Dan Ports
On Tue, Jun 21, 2011 at 06:51:20PM -0400, Tom Lane wrote: > I find this to be poor style, and would like to see if there's any > support for getting rid of the "const" keywords. I'm in favor of removing them too. Dan -- Dan R. K. Ports MIT CSAILhttp://drkp.net/ --

Re: [HACKERS] Coding style point: "const" in function parameter declarations

2011-06-21 Thread Peter Geoghegan
On 21 June 2011 23:51, Tom Lane wrote: > I notice that the SSI code is rather heavily invested in function > declarations like this: > > extern bool PageIsPredicateLocked(const Relation relation, const BlockNumber > blkno); > > I find this to be poor style, and would like to see if there's any >

[HACKERS] Coding style point: "const" in function parameter declarations

2011-06-21 Thread Tom Lane
I notice that the SSI code is rather heavily invested in function declarations like this: extern bool PageIsPredicateLocked(const Relation relation, const BlockNumber blkno); I find this to be poor style, and would like to see if there's any support for getting rid of the "const" keywords. My o