Re: Question about coding of free space map - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question about coding of free space map
Date
Msg-id 18002.1409323202@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about coding of free space map  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: LIMIT for UPDATE and DELETE
Next
From: Andres Freund
Date:
Subject: Re: Misleading error message in logical decoding for binary plugins