[Top][All Lists]

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

Re: [PATCH] Unicode Lisp reader escapes

From: Eli Zaretskii
Subject: Re: [PATCH] Unicode Lisp reader escapes
Date: Tue, 09 May 2006 22:05:07 +0300

> From: Aidan Kehoe <address@hidden>
> Date: Tue, 9 May 2006 09:04:50 +0200
> Cc: address@hidden
>  > As far as I know, the GCPRO convention for arguments is mostly the
>  > following:
>  > 
>  > GCPRO args you pass to functions iff those functions can GC and you need
>  > to use the arg after the function returns.
> Okay. Do you know of any document detailing that?

Does the excerpt below from the Lisp manual answer your concerns?

> No-one followed up to my reference to what Ben Wing writes on the
> subject.

AFAIU, he is wrong, or at least inaccurate.  But maybe I misunderstand

>From (elisp)Writing Emacs Primitives:

       Within the function `For' itself, note the use of the macros
    `GCPRO1' and `UNGCPRO'.  `GCPRO1' is used to "protect" a variable from
    garbage collection--to inform the garbage collector that it must look
    in that variable and regard its contents as an accessible object.  This
    is necessary whenever you call `Feval' or anything that can directly or
    indirectly call `Feval'.  At such a time, any Lisp object that you
    intend to refer to again must be protected somehow.  `UNGCPRO' cancels
    the protection of the variables that are protected in the current
    function.  It is necessary to do this explicitly.

       It suffices to ensure that at least one pointer to each object is
    GC-protected; as long as the object is not recycled, all pointers to it
    remain valid.  So if you are sure that a local variable points to an
    object that will be preserved by some other pointer, that local
    variable does not need a `GCPRO'.  (Formerly, strings were an exception
    to this rule; in older Emacs versions, every pointer to a string needed
    to be marked by GC.)

reply via email to

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