Re: Printing LSN made easy

Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>

From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: Li Japin <japinli@hotmail.com>, ashutosh.bapat@enterprisedb.com
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>, pgsql-hackers <pgsql-hackers@postgresql.org>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Craig Ringer <craig.ringer@enterprisedb.com>
Date: 2020-11-30T13:06:42Z
Lists: pgsql-hackers
On Fri, Nov 27, 2020 at 9:51 PM Li Japin <japinli@hotmail.com> wrote:
>
> Hi,
>
> Here, we cannot use sizeof(but) to get the buf size, because it is a pointer, so it always
> 8 bytes on 64-bit or 4 bytes on 32-bit machine.

For an array, the sizeof() returns the size of memory consumed by the
array. See section "Application to arrays" at
https://en.wikipedia.org/wiki/Sizeof.
-- 
Best Wishes,
Ashutosh Bapat



Commits

  1. Simplify printing of LSNs

  2. Unwind some workarounds for lack of portable int64 format specifier