Re: Remove unneeded cast in heap_xlog_lock.

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove unneeded cast in heap_xlog_lock.
Date: 2025-08-23 14:57:53
Message-ID: de2fbb58-e7df-40f9-9c22-c314fca044f2@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 22.08.25 11:59, Álvaro Herrera wrote:
> On 2025-Aug-22, Kirill Reshke wrote:
>
>> I am uncertain about the delineation between when we make changes and
>> when we refrain from doing so.
>
> I think this is natural work after 9c727360bcc7, before which
> BufferGetPage() was a macro and strangely enough had its own cast
> embedded. As I understand, the less casts we have, the better. There's
> some other standardization work going on to remove unnecessary casts
> elsewhere, so I'm not sure why we wouldn't do this.

In the very first code import, BufferGetPage() was a regular function
that returned Page. (I suppose it was then turned into a macro, and
then back into an inline function.) Even in that first code import,
some callers cast the return to (Page), and some not. So I suppose this
style just crept in for some random and ancient reason and then got
copied around inconsistently. We should clean it up. Casts are bad.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-08-23 15:04:42 Re: PoC: pg_dump --filter-data <file> (like Oracle Where Clause on RMAN for specific tables)
Previous Message Noah Misch 2025-08-23 14:45:05 Re: Test instability when pg_dump orders by OID