[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiler warnings in dispnew.c
From: |
Andreas Schwab |
Subject: |
Re: Compiler warnings in dispnew.c |
Date: |
Mon, 29 Nov 2021 18:53:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
On Nov 29 2021, Stefan Monnier wrote:
> Andreas Schwab [2021-11-28 12:07:01] wrote:
>> - memcpy (&to->x, &from->x, sizeof *to - off);
>> + memcpy ((char *) to + off, (char *) from + off, sizeof *to - off);
>
> I wonder: is the (char*) cast sufficient or is it necessary to
> "obfuscate" the code by writing `to + off` instead of `&to->x`?
I think the point is that the address expression is not based on the
subobject.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Re: Compiler warnings in dispnew.c, Eli Zaretskii, 2021/11/28
Re: Compiler warnings in dispnew.c, Po Lu, 2021/11/28