Re: Coding style question

Поиск
Список
Период
Сортировка
Искать
От
imad
Тема
Re: Coding style question
Дата
Msg-id
1f30b80c0611021112l1282157ejb43c140b45edccf2@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Coding style question <korryd@enterprisedb.com>
Re: Coding style question imad <immaad@gmail.com>
Re: Coding style question Neil Conway <neilc@samurai.com>
Re: Coding style question <korryd@enterprisedb.com>
Re: Coding style question Neil Conway <neilc@samurai.com>
Re: Coding style question <korryd@enterprisedb.com>
Re: Coding style question Nolan Cafferky <Nolan.Cafferky@qualitysmith.com>
Re: Coding style question Andrew Dunstan <andrew@dunslane.net>
Re: Coding style question Gregory Stark <stark@enterprisedb.com>
Re: Coding style question <korryd@enterprisedb.com>
Re: Coding style question Tom Lane <tgl@sss.pgh.pa.us>
Re: Coding style question <korryd@enterprisedb.com>
Re: Coding style question Tom Lane <tgl@sss.pgh.pa.us>
Re: Coding style question <korryd@enterprisedb.com>
Re: Coding style question imad <immaad@gmail.com>
Re: Coding style question Tom Lane <tgl@sss.pgh.pa.us>
Re: Coding style question imad <immaad@gmail.com>
Re: Coding style question Andrew Dunstan <andrew@dunslane.net>
On 11/2/06, Gregory Stark  wrote:
>  writes:
>
> > I would probably write that as:
> >
> > ________________________________________________________________________
> >
> > static TransactionId
> > _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
> >                  Buffer buf, ScanKey itup_scankey)
> > {
> >     TupleDesc    itupdesc = RelationGetDescr(rel);
> >     int          natts    = rel->rd_rel->relnatts;
> >     Page         page     = BufferGetPage(buf);
> >     OffsetNumber maxoff   = PageGetMaxOffsetNumber(page);
> >     BTPageOpaque opaque   = (BTPageOpaque) PageGetSpecialPointer(page);
> >     OffsetNumber offset   = _bt_binsrch(rel, buf, natts, itup_scankey, false);
> >     Buffer       nbuf     = InvalidBuffer;
>
>
> The disadvantage of using initializers is that you end up contorting the code
> to allow you to squeeze things into the initializers and it limits what you
> can do later to the code without undoing them.
>
> For example, if later you find out you have to, say, lock a table before the
> itupdesc initializer then all of the sudden you have to rip out all the
> initializers and rewrite them as assignments after the statement acquiring the
> table lock.

Well, its about the coding style. And I doubt there exists a data type
which may not have
an initializer. A NULL / Zero is an option in all cases and you can do
whatever you want to assign it a value immediately after the
initialization section. My two cents!


--Imad
www.EnterpriseDB.com

В списке pgsql-hackers по дате отправления
От: Andrew Dunstan
Дата:
Сообщение: Re: Coding style question
От: Tom Lane
Дата:
Сообщение: Re: Coding style question
FAQ