Re: Convert varatt.h macros to static inline functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert varatt.h macros to static inline functions
Date: 2025-08-01 05:07:33
Message-ID: 2199599.1754024853@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> Another comment that can apply to all the patches presented on this
> thread. Could it be worth splitting these inline functions into a
> separate header that declares varatt.h, meaning that we'd need to
> think a bit more about the structures themselves and all the
> sub-macros like SET_VARSIZE_1B() & friends?

IIRC we already moved these macros out of postgres.h, some years ago.

I don't really see how we could hide the lower-level macros from
callers' eyes while still having them available to inline functions.
The point of this exercise IMO is not information hiding: it is to
be clearer about the input and output datatypes of the functions,
and to eliminate multiple-evaluation hazards.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-08-01 05:24:14 Re: Should --enable-debug set CFLAGS to -O0 instead of -O2?
Previous Message vignesh C 2025-08-01 04:33:03 Re: Logical Replication of sequences