Andres Freund <and...@anarazel.de> writes:
> On July 21, 2020 10:45:37 AM PDT, Antonin Houska <a...@cybertec.at> wrote:
>> I don't quite understand this part of the comment of the xl_heap_header
>> structure:
>> * NOTE: t_hoff could be recomputed, but we may as well store it because
>> * it will come for free due to alignment considerations.

> Unless you declare them as packed, structs will add padding to align members 
> correctly (if, and only if, the whole struct is stored well aligned).

I think that comment may be out of date, because what's there now is

 * NOTE: t_hoff could be recomputed, but we may as well store it because
 * it will come for free due to alignment considerations.
 */
typedef struct xl_heap_header
{
        uint16          t_infomask2;
        uint16          t_infomask;
        uint8           t_hoff;
} xl_heap_header;

I find it hard to see how tacking t_hoff onto what would have been a
4-byte struct is "free".  Maybe sometime in the dim past there was
another field in this struct?  (But I checked back as far as 7.4
without finding one.)

I don't particularly want to remove the field, but we ought to
change or remove the comment.

                        regards, tom lane


Reply via email to