all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: James Cloos <cloos@jhcloos.com>
Cc: emacs-devel@gnu.org
Subject: Re: Copying one Lisp_Object to another in C code?
Date: Thu, 1 Jul 2010 21:33:55 -0400	[thread overview]
Message-ID: <F06EA6C1-9948-4939-9C06-A510BDCD0E3B@raeburn.org> (raw)
In-Reply-To: <m3tyoiu45d.fsf@carbon.jhcloos.org>

On Jul 1, 2010, at 20:18, James Cloos wrote:
> Given:
> 
>    static void (foo)
>        Lisp_Object foo;
>    {
>        Lisp_Object bar;
>    /* etc */
> 
> is it OK to do:
> 
>        bar = foo;
> 
> or is there a function or macro one should call?

Simple assignments are done all over the place currently.  It would take some drastic reworking if some macro invocation were to become necessary.

> I presume GCPRO1 (foo) is in order either way?

Depending on the details of your usage, yes.  (If the value is always stored in other places where the version of the GC system that doesn't scan the entire stack and register set automatically will be able to find it, at any of the points where the GC system can be invoked, then you don't need an explicit GCPRO.  But then you have to understand where the old GC scanner will look, and when it can get invoked.)  Just being conservative about it shouldn't hurt, either.

Ken


  reply	other threads:[~2010-07-02  1:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02  0:18 Copying one Lisp_Object to another in C code? James Cloos
2010-07-02  1:33 ` Ken Raeburn [this message]
2010-07-02  1:42 ` Chong Yidong
2010-07-02  9:06 ` Andreas Schwab
2010-07-02 15:37   ` James Cloos
2010-07-04 22:29 ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=F06EA6C1-9948-4939-9C06-A510BDCD0E3B@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=cloos@jhcloos.com \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.