Tom Lane <[email protected]> wrote:

> Antonin Houska <[email protected]> writes:

> > We already introduced this definition above in the function to suppress this
> > kind of warning
> 
> >     union
> >     {
> >         alignas(int32) varlena hdr;
> >         char                data[sizeof(void *)];
> >     }                       chunk_header;
> 
> > The problem on a 32-bit system probably is that sizeof(void *) is 4. We need
> > some other constant. Maybe (sizeof(varlena) + 1) ...
> 
> This seems unnecessarily Rube Goldberg-ish already.

Indeed.

> Why not just
> 
>       uint64  chunk_header;
> 
> It will not hurt anything if the variable has more-than-required
> alignment.  And it'd be better if it were the same size everywhere.

That's certainly better. Thanks.

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com


Reply via email to