Re: Question about coding of free space map

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about coding of free space map
Date: 2014-08-29 14:40:02
Message-ID: 18002.1409323202@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> On 08/26/2014 05:13 AM, Tatsuo Ishii wrote:
>> While looking into backend/storage/freespace/freespace.c, I noticed
>> that struct FSMAddress is passed to functions by value, rather than
>> reference.

> There isn't really any strict coding rule on that. We pass RelFileNode's
> by value in many functions, for example.

The only reason RelFileNodes work like that is that Robert blithely
ignored the coding rule when he was revising things to pass those around.
I've never been terribly happy about it, but it wasn't important enough
to complain about.

The cases where it *would* be important enough to complain about would
be performance-critical code paths, which RelFileNode usages typically
don't appear in (if you're messing with one you're most likely going
to do a filesystem access). I'd be unhappy though if someone wanted
to start passing ItemPointers by value. I doubt we can rely on C
compilers to pass those as efficiently as they pass pointers.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-08-29 15:00:53 Re: Removing dependency to wsock32.lib when compiling code on WIndows
Previous Message Andres Freund 2014-08-29 14:39:57 Re: Misleading error message in logical decoding for binary plugins