Subj : Re: Longjmp in error reporters? To : Alain Frisch From : Brendan Eich Date : Fri May 27 2005 08:33 pm Alain Frisch wrote: > Alain Frisch wrote: > >> Hello, >> >> I'm embedding SpiderMonkey in a language with a notion of exceptions. >> Raising an exception is internally implemented with a longjmp. >> >> Is it safe to throw such an exception from an JSErrorReporter? >> It would escape from the JS evaluator. I'm worried about its internal >> state... > > > At least the error message should be released by hand... Ok, I guess > this is not a good idea. I will just copy the error in a global > variable, and throw the exception after the evaluator has returned. Yes, in general JS_* API entry points, and their js_* and static function underpinnings, may manually allocate resources. There is no unwind-protect with longjmp, so you have to know what you are doing. /be .