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

From: Greg Stark <stark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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-22 23:37:24
Message-ID: BANLkTi=7Ekhy3o1QPMG5ue44j6TATU-ur4_wE_kdbZQc1p315Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 22, 2011 at 5:41 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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 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.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-06-23 00:01:20 Re: Coding style point: "const" in function parameter declarations
Previous Message Alvaro Herrera 2011-06-22 22:52:54 Re: SYNONYMS (again)