Re: Question about coding of free space map

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: 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 12:14:12
Message-ID: 54006E94.3050007@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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. I thought our code practice is defining pointer to a struct
> data and using the pointer for parameter passing etc.
>
> typedef struct RelationData *Relation;
>
> IMO freespace.c is better to follow the practice.

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

IMHO it's clearer to pass small structs like this by value. For example,
it irritates me that we tend to pass ItemPointers by reference, when
it's a small struct that represents a single value. I think of it as an
atomic value, like an integer, so it feels wrong to pass it by reference.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ali Akbar 2014-08-29 13:25:18 Re: [REVIEW] Re: Fix xpath() to return namespace definitions
Previous Message Marko Tiikkaja 2014-08-29 11:56:13 Re: LIMIT for UPDATE and DELETE