John D Lamb <[EMAIL PROTECTED]> writes: > Brian Gough wrote: >> Jochen Küpper writes:
>>> 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. > A check in the _free codes would also add a small overhead. Two good arguments; I agree that the current code is what it should be. Maybe a comment could be added in the code: ,---- | Index: block/init_source.c | =================================================================== | RCS file: /cvs/gsl/gsl/block/init_source.c,v | retrieving revision 1.7 | diff -u -r1.7 init_source.c | --- block/init_source.c 26 Jun 2005 13:26:59 -0000 1.7 | +++ block/init_source.c 12 Jun 2006 21:20:39 -0000 | @@ -74,6 +74,11 @@ | void | FUNCTION (gsl_block, free) (TYPE (gsl_block) * b) | { | + // no check for b == 0 performed: | + // - For most people calling this function on a null pointer is | + // usually an error, rather than by design, so it is helpful | + // to get a segmentation fault. | + // - The check imposes a small performance overhead. | free (b->data); | free (b); | } `---- This might be rephrased shorter/better by a native speaker... Thinking of it, maybe it should even go into the documentation. Greetings, Jochen -- Einigkeit und Recht und Freiheit http://www.Jochen-Kuepper.de Liberté, Égalité, Fraternité GnuPG key: CC1B0B4D (Part 3 you find in my messages before fall 2003.) _______________________________________________ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl