Jochen Küpper wrote:
> John D Lamb <[EMAIL PROTECTED]> writes:
>
>   
>>     gsl_matrix_free( b );
>>     
>
> [...]
>
>   
>> Exceptions are only really designed to handle the third case.
>>     
>
> Will "free" really throw an exception when compiled by a C++ compiler?
Come to think of it, probably not. I don't think exceptions are defined
for alloc and free and if they were, then behaviour like new and delete
might make sense. delete doesn't throw exceptions; so free ought not to
either.

gsl_matrix_alloc and gsl_matrix free behave like alloc and free and so I
guess gsl_matrix_alloc returns 0 on failure and gsl_matrix_free should
not be called with a null pointer.

In any case, it's more sensible to check whether pointers are null and
set them null after freeing a matrix than to try to use
exception-handling to deal with gsl_matrices allocation and destruction.

-- 
JDL



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to