unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Po Lu <luangruo@yahoo.com>, Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: Compiler warnings in dispnew.c
Date: Mon, 29 Nov 2021 18:53:17 +0100	[thread overview]
Message-ID: <8735neq25u.fsf@igel.home> (raw)
In-Reply-To: <jwvmtlm6ej5.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 29 Nov 2021 12:49:56 -0500")

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."



  reply	other threads:[~2021-11-29 17:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fsrg7gdt.fsf.ref@yahoo.com>
2021-11-28  9:56 ` Compiler warnings in dispnew.c Po Lu
2021-11-28 10:48   ` Eli Zaretskii
2021-11-28 10:57     ` Andreas Schwab
2021-11-28 11:02     ` Po Lu
2021-11-28 11:07       ` Andreas Schwab
2021-11-28 15:29         ` Eli Zaretskii
2021-11-29  0:35           ` Po Lu
2021-11-29 17:49         ` Stefan Monnier
2021-11-29 17:53           ` Andreas Schwab [this message]
2021-11-28 11:03     ` Eli Zaretskii
2021-11-28 11:10       ` Andreas Schwab
2021-11-28 11:18         ` Eli Zaretskii
2021-11-28 11:44           ` Andreas Schwab
2021-11-28 11:11       ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735neq25u.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).