Re: Remove useless casts to (void *)

Jacob Champion <jacob.champion@enterprisedb.com>

From: Jacob Champion <jacob.champion@enterprisedb.com>
To: Aleksander Alekseev <aleksander@tigerdata.com>
Cc: pgsql-hackers@lists.postgresql.org, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-11-20T18:16:19Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove useless casts to (void *)

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