| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | Gregory Stark <stark(at)enterprisedb(dot)com> |
| Cc: | korryd(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Coding style question |
| Date: | 2006-11-02 19:08:05 |
| Message-ID: | 454A4215.4030107@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Gregory Stark wrote:
> <korryd(at)enterprisedb(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | imad | 2006-11-02 19:12:51 | Re: Coding style question |
| Previous Message | Martijn van Oosterhout | 2006-11-02 19:04:12 | Re: Design Considerations for New Authentication Methods |