I think I will use the first one then. Are there any potential problems.. except for some code using longjmp() directly?

On Sat, 23 Aug 2008, Henrik Grubbström (Lysator) @ Pike (-) developers forum 
wrote:

ONERROR handle;
SET_ONERROR (handle, my_free_function, my_mem);
/* do stuff which may throw */
UNSET_ONERROR (handle);

If you want my_free_function to be called even if nothing was thrown,
use CALL_AND_UNSET_ONERROR instead.

That's probably the proper solution in this case, but it's not quite a
catch...

 JMP_BUF ctx;

 if (SETJMP(ctx)) {
   /* Something was thrown. */
 } else {
   /* Some code that might throw. */
 }
 UNSETJMP(ctx);
  • cat... Arne Goedeke
    • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
      • ... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum
        • ... Arne Goedeke
      • ... Arne Goedeke
        • ... Mirar @ Pike developers forum
          • ... Arne Goedeke
        • ... Martin Stjernholm, Roxen IS @ Pike developers forum

Reply via email to