help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Help with GSL Matrices


From: John D Lamb
Subject: Re: [Help-gsl] Help with GSL Matrices
Date: Sun, 11 Jun 2006 16:36:21 +0100
User-agent: Thunderbird 1.5 (X11/20060317)

Jochen Küpper wrote:
> John D Lamb <address@hidden> 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





reply via email to

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