Re: Remove useless casts to (void *)

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Remove useless casts to (void *)
Date: 2025-11-20 14:01:49
Message-ID: CAJ7c6TNKK1_Kq4t0_XgNPraRKKcuMtH4eZPfq9YcVP09OXJC5A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Bertrand,

> The attached also remove casts that have been added since 7f798aca1d5, the ones
> in pg_publication.c, lock.c and tuplesortvariants.c.
>
> The patch has been generated with the help of the .cocci script [2] (though I
> manually reviewed and removed some matches that, I think, were not appropriate).

I didn't review the entire patch but one change caught my attention:

```
- databuf = (void *) ((char *) databuf + avail);
+ databuf = (char *) databuf + avail;
```

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. Personally I don't think this is a good
change.

These were just my two cents. All in all I'm neither for nor against the patch.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mircea Cadariu 2025-11-20 14:04:30 Re: Metadata and record block access stats for indexes
Previous Message Aleksander Alekseev 2025-11-20 13:49:51 Re: 10% drop in code line count in PG 17