Jean Abou Samra <j...@abou-samra.fr> writes:

> By the way, I have a side question. Suppose I have determined
> that I need to mark the local variable scm_obj with
> scm_remember_upto_here in this code:
>
> SCM scm_obj = get_it_from_somewhere ();
>
> return something_that_needs_scm_obj_alive;
>
> // Is this correct?
> scm_remember_upto_here (scm_obj);
>
>
> Might the compiler detect that return exits the function and
> ignore the scm_remember_upto_here?

return; releases the stack frame.  "return
something_that_needs_scm_obj_alive;" is not a valid pattern unless the
returned value itself is an SCM that will cover scm_obj in its GC scope.

-- 
David Kastrup

Reply via email to