This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: free


Jochen Küpper writes:
 > > I checked the source code for gsl_matrix_free and it will fail if passed
 > > a null pointer.
 > 
 > Shouldn't the GSL free-routines be changed like the following patch?

My thinking on that was that for most people calling the free()
functions on a null pointer is usually an error rather than by design,
so it's helpful to get a segmentation fault.  

In general, I've never been convinced that free'ing a null pointer is
particularly useful as opposed to just doing "if (p) free(p)" in the
application.

-- 
Brian Gough


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]