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

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Dan Ports <drkp(at)csail(dot)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Coding style point: "const" in function parameter declarations
Date: 2011-06-23 00:06:43
Message-ID: BANLkTikzttf_Sjt-kDWGj7VyzuhOgwJQZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23 June 2011 00:37, Greg Stark <stark(at)mit(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-06-23 00:53:54 Re: crash-safe visibility map, take five
Previous Message Tom Lane 2011-06-23 00:01:20 Re: Coding style point: "const" in function parameter declarations