Re: Question about coding of free space map

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Question about coding of free space map
Дата
Msg-id 54006E94.3050007@vmware.com
обсуждение исходный текст
Ответ на Question about coding of free space map  (Tatsuo Ishii <ishii@postgresql.org>)
Ответы Re: Question about coding of free space map  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: LIMIT for UPDATE and DELETE
Следующее
От: Ali Akbar
Дата:
Сообщение: Re: [REVIEW] Re: Fix xpath() to return namespace definitions