Subject: Re: Remove useless casts to (char *)

From: Peter Eisentraut <[email-masked]>
Date: Sun, 23 Feb 2025 15:23:57 +0100

I have committed the rest of this with the adjustments you suggested.

On 10.02.25 18:44, Dagfinn Ilmari Mannsåker wrote:
>>   Here is a new patch set rebased over that.
> 
> I had a more thorough read-through this time (as well as applying and
> building it), and it does make the code a lot more readable.
> 
> I noticed you in some places added extra parens around remaining casts
> with offset additions, e.g.
> 
> -		XLogRegisterData((char *) old_key_tuple->t_data + SizeofHeapTupleHeader,
> +		XLogRegisterData(((char *) old_key_tuple->t_data) + SizeofHeapTupleHeader,
>   						 old_key_tuple->t_len - SizeofHeapTupleHeader);
> 
> But not in others:
> 
> -		memcpy((char *) tuple->t_data + SizeofHeapTupleHeader,
> -			   (char *) data,
> -			   datalen);
> +		memcpy((char *) tuple->t_data + SizeofHeapTupleHeader, data, datalen);
> 
> 
> I don't have a particularly strong opinion either way (maybe -0.2 on the
> extra parens), but I mainly think we should keep it consistent, and not
> change it gratuitously.
> 
> Greppig indicates to me that the paren-less version is more common:
> 
> $ git grep -P '\(\w+\s*\**\) [\w>-]+ \+ \w+' | wc -l
> 283
> $ git grep -P '\(\(\w+\s*\**\) [\w>-]+\) \+ \w+' | wc -l
> 96
> 
> So I think we should leave them as they are.
> 
> - ilmari
> 
>

---

From: Vladlen Popolitov <[email-masked]>
Date: Wed, 26 Mar 2025 22:01:47 +0700

>>>   Here is a new patch set rebased over that.
Hi

I mentioned this patch in my message 
https://www.postgresql.org/message-id/f28f3b45ec84bf9dc99fe129023a2d6b%40postgrespro.ru
Starting from it queries with Parallel Seq Scan (probably with other 
parallel executor nodes)
hang under the debugger in Linux and MacOs.
-- 
Best regards,

Vladlen Popolitov.

---

From: Michael Paquier <[email-masked]>
Date: Thu, 27 Mar 2025 07:20:25 +0900

On Wed, Mar 26, 2025 at 10:01:47PM +0700, Vladlen Popolitov wrote:
> I mentioned this patch in my message https://www.postgresql.org/message-id/f28f3b45ec84bf9dc99fe129023a2d6b%40postgrespro.ru

Uh.  How could a simple cast impact a parallel seqscan?  That seems
unrelated to me.
--
Michael

---

From: Vladlen Popolitov <[email-masked]>
Date: Thu, 27 Mar 2025 13:46:47 +0700

> Uh.  How could a simple cast impact a parallel seqscan?  That seems
Hi Michel,

  I changed the debugging extension in VScode and this issue disappeared.
I am sorry for disturbing and taking your time.

-- 
Best regards,

Vladlen Popolitov.