emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying one Lisp_Object to another in C code?


From: Ken Raeburn
Subject: Re: Copying one Lisp_Object to another in C code?
Date: Thu, 1 Jul 2010 21:33:55 -0400

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 via email to

[Prev in Thread] Current Thread [Next in Thread]