Re: Coding style question

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Coding style question
Дата
Msg-id 454A4215.4030107@dunslane.net
обсуждение исходный текст
Ответ на Re: Coding style question  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark wrote:
> <korryd@enterprisedb.com> 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.
>
>   

True. And in any case, we tend not to be terrribly anal about style 
preferences, especially if they are not documented.

I am sure I have done lots of things in ways other people would not 
dream of, and I have certainly seen code done in a style I would never use.

This is a not atypical situation for open source projects, unlike 
commercial situations where it is easier to enforce a corporate style.

cheers

andrew


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Design Considerations for New Authentication Methods
Следующее
От: imad
Дата:
Сообщение: Re: Coding style question