octave-maintainers
[Top][All Lists]
Advanced

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

Re: unwind_protect & try/catch combined corner case


From: Søren Hauberg
Subject: Re: unwind_protect & try/catch combined corner case
Date: Thu, 07 Jan 2010 10:19:53 +0100

tor, 07 01 2010 kl. 09:46 +0100, skrev Jaroslav Hajek:
> But is the former correct? I believe it's the most reasonable behavior:
> the "try" section is entered, then unwind_protect. An interrupt occurs
> there, hence control is transferred to unwind_protect_cleanup.
> unwind_protect_cleanup executes some code which finally raises an
> error;

I'm with you so far...

>  however, this error is suppressed because we're in a "try"
> section.

I don't understand this. If you raise an error, shouldn't it be caught?
I think I would expect the following output from your program:

  cleanup inner
  caught error
  cleanup outer

I haven't tried your current code, but what is the result if the
following program?

  unwind_protect
    fdisp (stderr, "Press Ctrl-C");
    pause (3);
  unwind_protect_cleanup
    svd () # this raises an error
  end_unwind_protect

Will the user get the error message from 'svd' (which would be quite
helpful for debugging)? Will the user be able to catch this error?

Soren



reply via email to

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