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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to