Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.
Date: 2015-02-21 07:15:35
Message-ID: CAB7nPqRU3t3KZ7Yzm+Qr367cVPA05GScKHr2P4o4hWGGVNpKBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Sat, Feb 21, 2015 at 10:16 AM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Tom Lane wrote:
>
>> A relevant technique that's been used in a lot of our code is to define
>> an intermediate macro, along the lines of
>>
>> #define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits)
>>
>> or maybe it would better be called HeapTupleHeaderFixedSize or
>> HeapTupleHeaderOverhead. Not sure what reads most nicely.
>
> Maybe the macro could take an argument which is the size of the data
> part, so that it could be allocated together with the Overhead part; the
> addition would be done in the macro rather than its caller.

I think that we would be just fine with SizeofHeapTupleHeader, a
notation with a suffix of the type FixedSize or Overhead is not
something used in any of the existing #define of src/include using
offsetof().
My 2c.
--
Michael

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2015-02-21 17:20:25 pgsql: Don't require users of src/port/gettimeofday.c to initialize it.
Previous Message Tom Lane 2015-02-21 06:46:51 pgsql: Some more FLEXIBLE_ARRAY_MEMBER fixes.