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

Re: core dumped while scheme_apply



Quoting Paul Argentoff:
> On Thu, Feb 14, 2002 at 09:32:34AM -0700, Matthew Flatt wrote:
> 
> > Use scheme_setjmp:
> > 
> >  ...
> >   if (scheme_setjmp(scheme_error_buf)) {
> >     /* There was an error */
> >     ...
> >   } else {
> >     v = scheme_eval_string(s, env);
> >   }
> 
> Well, I've read this in docs. But the question is: should I call
> setjmp before or after evaluation?

Before, as above.

Calling `scheme_setjmp' has the side-effect of installing a return
target into `scheme_error_buf'. Then, when an exception triggers a call
to `scheme_longjmp', the information in `scheme_error_buf' is used to
escape from the exception context.

> My code looks like this:
> 
> scheme_apply(sfFunction,3,args);
> if (scheme_setjmp(scheme_error_buf)) {
>   return -1;
> }

In this case, the `scheme_setjmp' doesn't do anything, because
`scheme_error_buf' is used before `scheme_apply' returns.

Matthew