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

From Peter Geoghegan
Subject Re: Coding style point: "const" in function parameter declarations
Date
Msg-id BANLkTikzttf_Sjt-kDWGj7VyzuhOgwJQZQ@mail.gmail.com
Whole thread Raw
In response to Re: Coding style point: "const" in function parameter declarations  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On 23 June 2011 00:37, Greg Stark <stark@mit.edu> 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 understand what the intent of a
> function was and it wasn't obvious that some of the arguments appeared
> to be pass by value but were actually pass by reference it made things
> really surprising.

I agree that the inconsistency is annoying. If we were starting from
scratch, I'd encourage abandoning the convention. It's a leaky
abstraction.

At the risk of saying something that will raise eyebrows, I'll point
out that the win32 API follows a similar practice. The difference is
that they have consistent conventions in how they name their typdefs,
so that you get to learn the patterns.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Coding style point: "const" in function parameter declarations
Next
From: Jeff Davis
Date:
Subject: Re: crash-safe visibility map, take five