octave-maintainers
[Top][All Lists]
Advanced

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

Re: sparse matrices and error handling


From: Paul Kienzle
Subject: Re: sparse matrices and error handling
Date: Sun, 17 Nov 2002 18:54:56 -0500
User-agent: Mutt/1.2.5.1i

On Sun, Nov 17, 2002 at 12:10:57PM -0600, John W. Eaton wrote:
> 
> | I'll see to what extent I can turn it into error propogation code.  I may
> | have to use setjmp/longjmp to catch errors from deep within superlu.  Andy,
> | do you have any opinions on how this should be done?  I'm thinking of
> | changing the internal functions so that instead of returning matrices, they
> | take a matrix reference as a parameter and modify that, and return an
> | error flag.
> 
> If you can't avoid longjmp, then you should set it up as a call to
> foreign code and use the octave_jump_to_enclosing_context when you
> need to bail out.  There are macros to do this in quit.h for
> non-fortran code.  I'm currently using them around the call to
> readline for user input.

IIRC, SuperLU needs to be compiled with an error function defined which
prints the error and exits.  I don't believe it allows for an error
handler which returns.  It's been a long time since I looked at it though.

BTW, isn't it a misnomer to refer to the setjmp/longjmp setup as only
applying to foreign code?  It seems to me that you would want it around
any code which can take more than 1/2 second or so to complete, even
if it is coded in C++ and is part of liboctave.  If you don't have it,then
how can you break out of such code since Ctrl-C can't directly throw an
exception?

Also, I saw one post suggesting that the gcc java and ada implementations
could convert signals into exceptions, but I didn't see a follow-up
explanation.  Perhaps we should post to the gcc list?

> | This business of propogating error_state is why I 
> | was looking at C++ exception handling a couple of years ago.  Between 
> | that and better memory recover, I'm almost convinced that C++ exceptions 
> | are a good idea.
> 
> What would it take to more than almost convince you?

The usual question of cost and convenience.

In order to properly collect resources after exceptions you have to write
your code just so.  I don't yet have a feel for how inconvenient "just so"
is.  Is it much less hassle than unwind_protect?

I would also like to know how much it costs compared to unwind_protect.

Paul Kienzle
address@hidden



reply via email to

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