Re: Remove useless casts to (void *) - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: Remove useless casts to (void *)
Date
Msg-id CAOYmi+mP7mVcmtvTMtWksHJyftVpXsNuqiyTf6eYx4EhMVg1nQ@mail.gmail.com
Whole thread Raw
In response to Re: Remove useless casts to (void *)  (Aleksander Alekseev <aleksander@tigerdata.com>)
List pgsql-hackers
On Thu, Nov 20, 2025 at 6:02 AM Aleksander Alekseev
<aleksander@tigerdata.com> wrote:
> Here `databuf` has a type (void*). Although the code is correct, it
> replaces an explicit cast (which I read "yes, we know what we are
> doing") with an implicit one.

"Yes, we know what we are doing" is the argument against doing it,
though. There's no upside to telling the compiler that in this case:
if it's correct, the compiler would have done it for you anyway, and
if it's buggy, now the compiler has been told to stay silent.

So +1 on removing unneeded (void *) casts in general, for the sake of
establishing consensus, though I haven't looked at this particular
patch in detail.

--Jacob



pgsql-hackers by date:

Previous
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Next
From: Robert Haas
Date:
Subject: Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent